npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mad-dogs/seq-logger

v2.3.2

Published

Logging to a Seq server from multiple hosts and applications, for NodeJS and browser

Downloads

3

Readme

Logging to a Seq log server

Logging to a Seq log server for both NodeJS and browser.

Log level

The current log level determines how much detailed logging is sent to the server. Can be changed at any time using for example log.level("debug"). With "debug" log level all log items except "verbose" are sent to the log server.

Available log levels are:

"off" | "fatal" | "error" | "warning" | "information" | "debug" | "verbose"

Logging

Create an instance of the SeqLogger class.

Use one of the SeqLogger methods to post a new log item to the server:

fatal(arg: string | Error, ...properties: any[]): void
error(arg: string | Error, ...properties: any[]): void
warn(arg: string | Error, ...properties: any[]): void
info(arg: string | Error, ...properties: any[]): void
debug(arg: string | Error, ...properties: any[]): void
verbose(arg: string | Error, ...properties: any[]): void

Starting a Seq log server with Docker

Run a Seq instance with ephemeral storage and all services on port 5341:

docker run -e ACCEPT_EULA=Y -p 5341:80 datalust/seq:latest

Open http://localhost:5341 in your web browser.

NodeJS and web browser application example

import { log, SeqLogger } from "@mad-dogs/seq-logger";

let logger = new SeqLogger(
  "demo1",
  "test",
  "0.0.0",
  "debug",
  "http://localhost:5341"
);
logger.info("Hello {target}", "world");
log.debug("Using the one and only singleton logger");

Logging from multiple hosts and applications

Log posts always include a host name, application name and an auto-generated instance GUID.

Security

The Seq log server can be configured to accept log posts only when the log client includes an API key in the log request.

Generate an API key in the Seq server web interface and add as an additional argument when creating the SeqLogger instance.

Supress default startup logging

The SeqLogger automatically logs default information at when the logger is created. Suppress this by adding a false argument after the API key.