Skip to content

Builds on LoggerJS's skeleton to provide similar logging functionalities for Node.js modules.

Notifications You must be signed in to change notification settings

luscus/node-LoggerJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Builds on LoggerJS's skeleton to provide similar logging functionalities for Node.js modules.

Features:

  • Uses the console to output information to the Browser Developer Tools.
  • Supports sending the log entry (as JSON) to some Log Server.
  • Supports write to log files
  • custom tasks to be processed on specified log levels.
  • Handles unexpected errors in the window.
  • Handles process exits => report shutdown and kill

Please report bugs there on GitHub.


Usage

Set Dependency

Add following entry to your package.json in the dependencies property

"dependencies": {
  "loggerjs" : "0.0.x"
},

Instanciate

Use a Logger instance in a Node.js module

var LoggerJS = require('loggerjs'),
options = {
  namespace :    'my.awesome.project',
  status :       true,
  logLevel :     LoggerJS.DEBUG,
  logServerUrl : '<logging_service_url>',
  tags :         ['myproject', 'node', 'something']
},
logger = new LoggerJS.Logger(options);

please refer to the LoggerJS README for an up to date list of options.

API

please refer to the LoggerJS README for an up to date API description.


Logfile API (Node specific)

useLogfile

Activates writing log entries to files.

Parameter:

  • path: absolute path to the logfile

Example:

// activates file logging
logger.useLogfile(<path>);

enableLogfile

Enables logfile task.

Example:

// enables file logging
logger.enableLogfile();

disableLogfile

Disables logfile task.

Example:

// disables file logging
logger.disableLogfile();

About

Builds on LoggerJS's skeleton to provide similar logging functionalities for Node.js modules.

Resources

Stars

Watchers

Forks

Packages

No packages published