Skip to content
forked from arb/good-file

File broadcasting for Good process monitor

License

Notifications You must be signed in to change notification settings

reedog117/good-file

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

good-file

File logging module for good process monitoring.

Build StatusCurrent Version

Lead Maintainer: Adam Bretz

Usage

good-file is a good reporter implementation to write hapi server events to the local file system.

Good File

GoodFile (events, config)

Creates a new GoodFile object where:

  • events - an object of key value pairs.
    • key - one of the supported good events indicating the hapi event to subscribe to
    • value - a single string or an array of strings to filter incoming events. "*" indicates no filtering. null and undefined are assumed to be "*"
  • config - specifications for the file that will be used. All file operations are done in "append" mode.
    • String - a string that indicates the log file to use. Opened in "append" mode.
    • Object - a configuration object for automatically generated files. Auto generated files use the following pattern for file naming: "{options.prefix}-{utcTime.format(options.format)}-{random string}.{settings.extension}"
      • path - required. Path to the directory to store log files.
      • [format] - a MomentJs format string. Defaults to "YYYY-MM-DD".
      • [extension] - file extension to use when creating a file. Defaults to ".log". Set to "" for no extension.
      • [prefix] - file name prefix to use when creating a file. Defaults to "good-file"
      • [rotate] - a string indicating a log rotation time span. The designated time span will start a timer that will trigger at the end of the specified time span. For example, using "daily", a new log file would be created at approximately 11:59:59.999 on the current day. Please see this section in the Moment.js documentation for more details. The string must be one of the following values: ['hourly', 'daily', 'weekly', 'monthly'].

Limitations A new file is always created when the process starts, regardless of rotate option; this is to prevent collisions. So if you start and stop the process several times in a row, there will be a new file created each time and a new timer will start at the beginning of the process. There are several time related precision issues when working with JavaScript. The log rotation will happen "close enough" to the desired rotate option.

GoodFile Methods

goodfile.init(stream, emitter, callback)

Initializes the reporter with the following arguments:

  • stream - a Node readable stream that will be the source of data for this reporter. It is assumed that stream is in objectMode.
  • emitter - an event emitter object.
  • callback - a callback to execute when the start function has complete all the necessary set up steps and is ready to receive data.

About

File broadcasting for Good process monitor

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%