# @libs/log A real simple logger application. May Optional Log to A File and a loki-server via http or udp. >__Graylog__ is no longer supported ## Installation - `npm install --save @libs/log` ## Usage `const Log = require('@libs/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 (with default format) __YYYY-MM-DDTHH:ii:ss SERVER INFO this ["array",8] 4 {"type": "test"}__ ### Formatting You can edit the output using the __format__-Option. Possible Setting: - __{timestamp}__: Display the timestamp in ISO format - __{hostname}__: Display the hostname - __{name}__: Display the Application name - __{loglevel}__: Display the Loglevel - __{message}__: Display the Message ### Options >__Graylog__ is no longer supported ```json { "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)", "format": "Format the output. Default: {timestamp}\\t{hostname}\\t{loglevel}\\t{message}", "loki": { "active": "true or false", "server":"loki-server" } } ``` ### Examples Check the Examples to get a Feeling about the possibilities.