Skip to content

jessie-codes/gelf-file

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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