Skip to content
Snippets Groups Projects
Select Git revision
  • 18f79a8748a1ab4b9684be8c04512e730ce393c2
  • main default protected
  • 3.1.7
  • 3.1.6
  • 3.1.5
  • 3.1.4
  • 3.1.3
  • 3.1.2
  • 3.1.1
  • 3.1.0
  • 2.14.0
  • 2.13.5
  • 2.13.4
  • 2.13.3
  • 2.13.2
  • 2.13.0
  • 2.12.1
  • 2.12.0
  • 2.11.0
  • 2.10.1
  • 2.10.0
  • 2.9.1
22 results

log

log

A real simple logger application. May Optional Log to A File and a graylog-server via http or udp.

Installation

  • npm install --save @general/config

Usage

const Log = require('@general/log')
let log = new Log(options)

Note: The options Part may be omitted, as all parts are optional, but using the name is recommended, as without it, the package-name will be used

Methods

  • log.info('This is an Information' )
  • log.notice('This is a Notice' )
  • log.warn('This is a Warning' )
  • log.error('This is an Error' )
  • log.fatal('This is a Fatal Message' )
  • log.debug('This is a Debug Message' )

You may also add any number of any parameter. The objects will be concatenated using your custom delimeter and stringified.

e.g.:

log.info('this', ['array', 8], 4, {type:'test'})

will logged as

__YYYY-MM-DDTHH:ii:ss SERVER INFO this ["array",8] 4 {"type": "test"}

Options

{
  "name": "Name of App. Default: Name of BaseFolder",
  "hostname": "Server Hostname, Default: os.hostname()",
  "file": "'File to Append Log to",
  "path": "Path Logfile located",
  "loglevel": "Minimal LogLevel. Default: WARN",
  "delimeter": "How to join multiple outputs. Default: (a single space)",
  "graylog": {
    "active": "true or false",
    "mode": "http or udp, defaults to udp",
    "server": "graylog-server",  
    "port": "graylog-port"
  }
}

Examples

Check the Examples to get a Feeling about the possibilities.