1.8.1 • Published 5 years ago
gelf-file v1.8.1
gelf-file
Gelf formatted log files.
Installation
npm install gelf-fileArguments
- 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:
0EMERGENCYsystem unusable1ALERTimmediate action required2CRITICALcondition critical3ERRORcondition error4WARNINGcondition warning5NOTICEcondition normal, but significant6INFOa purely informational message7DEBUGdebugging 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
