gelf-file
Gelf formatted log files.
Installation
npm install gelf-file
Arguments
- file
String
: The path for the log file. - opts
Object
:
- logLevel : The log level for the application.
- timestamp The format for the timestamp. See time-stamp
- args
Object
: An object containing parameters that should be added to each log entry.
Log Levels
Mirror that of syslog:
0
EMERGENCY
system unusable1
ALERT
immediate action required2
CRITICAL
condition critical3
ERROR
condition error4
WARNING
condition warning5
NOTICE
condition normal, but significant6
INFO
a purely informational message7
DEBUG
debugging information
Usage
const logger = require('gelf-file')('./app.log', {logLevel: 'WARNING'}, {app: 'my-app'});
logger.log('DEBUG', 'started app');
API
Parameters
- logLevel
String
- The desired log level. Valid values are listed in the log level list above. - message
String
- The log message. - tags
Object
- Additional information to store with the log message.
Functions
log(logLevel, message, tags)
- Creates a log entry for the desired log level.emergency(message, tags)
- Creates an emergency log entry.alert(message, tags)
- Creates an alert log entry.critical(message, tags)
- Creates an critical log entry.error(message, tags)
- Creates an error log entry.warning(message, tags)
- Creates an warning log entry.notice(message, tags)
- Creates an notice log entry.info(message, tags)
- Creates an info log entry.debug(message, tags)
- Creates an debug log entry.
Inspiration
This project was inspired by log