Class Index | File Index

Classes


Class comb.logging.appenders.JSONAppender


Extends comb.logging.appenders.FileAppender.
Appends messages to a file in JSON format. The messages are logged to an array in a JSON file The file is always overwritten

//example log.json
[
   {
     "timestamp" : "Wed Jun 08 2011 11:16:20 GMT-0500 (CDT)",
     "level" : "INFO",
     "name" : "comb",
     "message" :  "INFO MESSAGE!!!!"
   }
 ]


Defined in: jsonAppender.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Fields borrowed from class comb.logging.appenders.Appender:
level, name, pattern
Methods borrowed from class comb.logging.appenders.Appender:
append
Class Detail
comb.logging.appenders.JSONAppender(options)
Parameters:
{Object} options Optional
options to assign to this Appender
{String} options.name Optional, Default: "appender"
the name of this Appender. If you want two of the same type of appender on a logger it must have a different name.
{String} options.pattern Optional, Default: "{"timestamp" : "{timeStamp}", "level" : "{levelName}", "name" : "{name}", "message" : "{message}"}"

Available Options for formatting see comb.string.format for formatting options

  • timeStamp - the timestamp of the event being logged
  • level - the comb.logging.Level of the event
  • levelName - the name of the level being logged
  • name - the name of the logger logging the event
  • message - the message being logged
{comb.logging.Level|String} options.level Optional, Default: comb.logging.Level.INFO
the logging level of this appender

Note: the level can be different from the logger in the case that you want a particular logger to only log particular event of a level. For example an appender that only logs errors. BEWARE that if the appenders level is lower than the logger is will not recieve any messages.

{String} options.file Optional, Default: "./log.json"
the file to log events to.
{String} options.encoding Optional, Default: "utf8"
the encoding of the file.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Nov 18 2011 01:10:52 GMT-0600 (CST)