Coder Social home page Coder Social logo

seq-logger's Introduction

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 "@diginet/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.

seq-logger's People

Contributors

anderswestberg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.