Class Table Of Contents

- All Classes
- All Files
- API
  - comb
    - logging
      - PropertyConfigurator
      - Level
      - BasicConfigurator
      - Logger
      - appenders
        - RollingFileAppender
        - ConsoleAppender
        - Appender
        - FileAppender
        - JSONAppender
    - PromiseList
    - Promise
    - regexp
    - array
    - string
    - collections
      - Pool
      - Iterable
      - HashTable
      - MaxHeap
      - Heap
      - Stack
      - AVLTree
      - AnderssonTree
      - Collection
      - RedBlackTree
      - Tree
      - Queue
      - BinaryTree
      - PriorityQueue
      - MinHeap
    - plugins
      - Middleware
      - Broadcaster
    - number
    - characters
    - date
- comb.logging.Logger
- Properties
  - additive
  - appenders
  - fullName
  - isDebug
  - isError
  - isFatal
  - isInfo
  - isOff
  - isTrace
  - isWarn
  - level
  - name
  - subLoggers
- Methods
  - addAppender
  - addAppenders
  - debug
  - error
  - fatal
  - getAppender
  - getLogger
  - getRootLogger
  - info
  - isAppenderAttached
  - log
  - removeAllAppenders
  - removeAppender
  - removeAppenders
  - trace
  - warn

# Class comb.logging.Logger

This class is the entry point for all logging actions in comb.

Logger should be retrieved by calling Logger.getLogger() NOT through the new keyword

All loggers in comb follow a heirarchy of inheritance based on a dot notation.

                             rootLogger - ""
                                     /         \
                                  "my"      "myOther"
                                  /               \
                            "my.logger"       "myOther.logger"
                               /                     \
                          "my.logger.Log"        "myOther.logger.Log"

In the above Tree the rootLogger is the base for all logger. my and myOther inherit from rootLogger my.logger inherits from my, and myOther.logger inherits from myOther. The logs do not have to be retrieved in order. If I set rootLogger to ERROR level and added a console appender to it the appender and level will be added to all logs. However if I set my to INFO level and add a fileAppender to it the level and appender will only be added to logs in "my" subtree. If you set my.logger to not be additive then levels, and appenders will not propogate down to the rest of the tree.

For information on levels see comb.logging.Level.

For information on appenders see

- comb.logging.appenders.Appender
- comb.logging.appenders.ConsoleAppender
- comb.logging.appenders.FileAppender
- comb.logging.appenders.JSONAppender
- comb.logging.appenders.RollingFileAppender

For information on configurators see comb.logging.BasicConfigurator or comb.logging.PropertyConfigurator.

Defined in: index.js.
Class Detail
comb.logging.Logger()

#### Example 1 :

    var logging = comb.logging,
        Logger = logging.Logger,
        appenders = logging.appenders,
        Level = logging.Level;

    //configure you logging environement

    var bc = logging.BasicConfigurator();
    //add console appender to all loggers
    bc.configure();
    //add a file appender to all loggers
    bc.configure(new appenders.FileAppender({file : "/var/log/myLog.log"}));

    //Retreiving a logger.
    var combLogger = Logger.getLogger("comb");
    var combCollectionLogger = Logger.getLogger("comb.collections");
    var treeLogger = Logger.getLogger("comb.collections.Tree");

    //set my treeLogger to DEBUG Level
    treeLogger.level = Level.DEBUG;
    //add a JSON appender to tree logger just for fun!
    treeLogger.addAppender(new appenders.JSONAppender({file : "/var/log/myTreeLogger.json"}));

    //NOW USE THEM

Field Detail
{Boolean} additive
set to false to prevent changes to this logger from propogating down.
{comb.logging.appenders.Appender} appenders
list of appenders this logger currently contains.
{String} fullName
the full path name of this Logger.
{Boolean} isDebug
true if this Loggers level is DEBUG
{Boolean} isError
true if this Loggers level is ERROR
{Boolean} isFatal
true if this Loggers level is FATAL
{Boolean} isInfo
true if this Loggers level is INFO
{Boolean} isOff
true if this Loggers level is OFF
{Boolean} isTrace
true if this Loggers level is TRACE
{Boolean} isWarn
true if this Loggers level is WARN
{comb.logging.Level} level
the level of this Logger
{String} name
the name of this logger this does not include the dot notated name
{Array} subLoggers
all loggers this logger is the parent of.
Method Detail
addAppender(appender)
Add an appender to this logger. If this is additive then the appender is added to all subloggers.

Parameters:
{comb.logging.Appender} appender
  the appender to add.

    if (!base.isUndefinedOrNull(appender)) {
        var name = appender.name;
        if (!(name in this.__appenders)) {
            this.__appenders[name] = appender;
            appender.level = this.level;
            this._tree.addAppender(appender);
        }
    }

addAppenders(appenders)
Short cut to add a list of appenders to this Logger

Parameters:
{Array} appenders

    appenders.forEach(base.hitch(this, "addAppender"));

debug(message)
Log an debug level message

Parameters:
{String} message
  the message to log.

    this.log(Level.DEBUG, message);

error(message)
Log an error level message

Parameters:
{String} message
  the message to log.

    this.log(Level.ERROR, message);

fatal(message)
Log an fatal level message

Parameters:
{String} message
  the message to log.

    this.log(Level.FATAL, message);

{comb.logging.Appender|undefined} getAppender(name)
Gets an appender from this logger

Parameters:
{String} name
  the name of the appender.

Returns:
  {comb.logging.Appender|undefined} returns the appender with the specified name or undefined if it is not found.

    var ret;
    if (name in this.__appenders) {
        ret = this.__appenders[name];
    }
    return ret;

<static> comb.logging.Logger.getLogger(name)
Retrieves/Creates a logger based on the name passed in

Parameters:
{String} name
  the name of the logger

    return rootTree.getLogger(name);

<static> comb.logging.Logger.getRootLogger()
Return the root of all loggers

    return rootTree.getRootLogger();

info(message)
Log an info level message

Parameters:
{String} message
  the message to log.

    this.log(Level.INFO, message);

isAppenderAttached(name)
Determines if an appender is attached.

Parameters:
{String} name
  the name of the appender.

    return (name in this.__appenders);

log(level, message)
Log a message

Parameters:
{comb.logging.Level} level
  the level the message is
{String} message
  the message to log.

    if (level.isGreaterOrEqualToo(this.level)) {
        if (Level.TRACE.equals(level)) {
            var err = new Error;
            err.name = "Trace";
            err.message = message || '';
            Error.captureStackTrace(err, arguments.callee);
            message = err.stack;
        } else if (Level.ERROR.equals(level) && base.isInstanceOf(message, Error)) {
            message = message.stack;
        }
        var type = level.name.toLowerCase(), appenders = this.__appenders;
        var event = {
            level : level,
            levelName : level.name,
            message : message,
            timeStamp : new Date(),
            name : this.fullName
        };
        for (var i in appenders) {
            appenders[i].append(event);
        }
    }

removeAllAppenders()
Removes all appenders from this logger and sub loggers if this Logger is additive.

    for (var i in this.__appenders) {
        this.removeAppender(i);
    }

removeAppender(name)
Removes and appender from this logger.

Parameters:
{String} name
  the name of the appender

    if (name in this.__appenders) {
        delete this.__appenders[name];
        this._tree.removeAppender(name);
    }

removeAppenders(appenders)
Removes a list of appenders from this logger.

Parameters:
{Array} appenders
  a list of names of appenders to remove

    appenders.forEach(this.removeAppender, this);

trace(message)
Log an trace level message

Parameters:
{String} message
  the message to log.

    this.log(Level.TRACE, message);

warn(message)
Log an warn level message

Parameters:
{String} message
  the message to log.

    this.log(Level.WARN, message);

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jan 31 2012 16:14:12 GMT-0600 (CST)