🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

s3pweb-logger

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

s3pweb-logger

This is a simple lib to log message

latest
npmnpm
Version
1.0.1
Version published
Maintainers
2
Created
Source

This is a simple lib to log message

Installation

npm install s3pweb-logger

Config

Configurations are stored in configuration files within your application, and can be overridden and extended by environment variables, command line parameters, or external sources. See : http://lorenwest.github.io/node-config/

  • Create a config folder

  • Create a file(s) with the name of your environment(s) like test.json

  • Paste this configuration template :

{
   "name": "your-application-name",

    "logger": {
    "source": false,
    "console": {
      "enable": true,
      "level": "debug"
    },
    "file": {
      "enable": true,
      "level": "info",
      "dir": "./logs"
    },
    "server": {
      "enable": true,
      "level": "trace",
      "url": "0.0.0.0",
      "port": "9998",
      "type": "elk"
    },
    "ringBuffer": {
      "enable": true,
      "size": 50
    }
  }
}
  • Adapt values with your expectations

Example :

const log = require('s3pweb-logger').logger
const { logger } = require('s3pweb-logger')

const child = log.child({ child: 'childName' })

log.info('one message from log')
logger.info('one message from logger')
child.info('one message from child')

Run example :

Pass the name of your environnement with NODE_ENV=xxxx before node

NODE_ENV=test node example/example.js

Bonus :

To start a ELK stack on docker :

chmod +x example/startElk.sh 

./example/startElk.sh

Or with docker compose :

docker-compose -f example/docker-stack.yaml up -d

Open your favorite browser : http://localhost:5601

Create an index with just * (replace logstash-* by *)

FAQs

Package last updated on 21 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts