gelf-file

1.8.1 • Public • Published

gelf-file

NPM

Known Vulnerabilities JavaScript Style Guide Commitizen friendly Build Status Coverage Status

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 unusable
  • 1 ALERT immediate action required
  • 2 CRITICAL condition critical
  • 3 ERROR condition error
  • 4 WARNING condition warning
  • 5 NOTICE condition normal, but significant
  • 6 INFO a purely informational message
  • 7 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

Readme

Keywords

Package Sidebar

Install

npm i gelf-file

Weekly Downloads

0

Version

1.8.1

License

MIT

Unpacked Size

15.3 kB

Total Files

8

Last publish

Collaborators

  • jessie-codes