The logger class.
@param {String} namespace - A namespace to identify the logger.
@param {Object} [settings] - An optional configuration to extend defaults.
163726
function (namespace, extendSettings) {

    if (typeof namespace !== 'string' || !namespace.trim().length) {
      throw new Error('A valid string namespace is required as first parameter.');
    }

    namespace = namespace.trim();

    var settings = extend({}, globalSettings, extendSettings);
    var history = [];

    /**
     * Update instance settings.
     * @param  {Object} newSettings
     */
    this.update = function (newExtendSettings) {
      settings = extend({}, settings, newExtendSettings);
    };

    /**
     * Return settings.
     * @return {Object}
     */
    this.getSettings = function () {
      return extend({}, settings);
    };

    /**
     * Add a new method level to instance.
     * @param {Object} level - Level description.
     * @param {String} level.name - Level name.
     * @param {Number} [level.priority] - Number priority. Default to 3.
     * @param {String} [level.color] - The console color. Default `null`.
     */
     this.addLevel = function (level) {
      level = addLevel(level);
      this[level.name] = function () {
        this._execute(level, arguments);
      };
    };

    /**
     * Get a copy of the history. Meta objects are referenced.
     * @return {Array}
     */
    this.getHistory = function () {
      return history.map(function (item) {
        return extend({}, item);
      });
    };

    /**
     * Record a log in logger history if configured.
     * @private
     * @param  {Date} date - Date of log.
     * @param  {Object} level - Reference to the level definition.
     * @param  {String} text - The raw message.
     * @param  {Object} [meta] - Metadata.
     */
    this._record = function (date, level, text, meta) {
      if (settings.history) {
        var item = {
          date: date.getTime(),
          level: level.name,
          text: text,
        };
        if (meta) item.meta = meta;
        history.push(item);
      }
    };

    /**
     * Create a log description message by logger configuration.
     * @private
     * @param  {Date} date - Date of log.
     * @param  {Object} level - Reference to the level definition.
     * @return {String} - The description.
     */
    this._prefix = function (date, level) {

      var dtime = '';
      var dlevel = '';
      var dnamespace = '';

      if (settings.displayTime) {
        var hh = formatTime(date.getHours());
        var mm = formatTime(date.getMinutes());
        var ss = formatTime(date.getSeconds());
        var ms = formatTime(date.getMilliseconds(), 3);
        dtime = hh + ':' + mm + ':' + ss + '.' + ms + ' ';
      }

      if (settings.displayLevel) {
        dlevel = level.name.toUpperCase() +' ';
      }

      if (settings.displayNamespace) {
        dnamespace = '['+ namespace +'] ';
      }

      var dmsg = (dtime + dlevel + dnamespace).trim();
      dmsg = dmsg.length ? dmsg : '';

      return dmsg;
    };

    /**
     * Log the message in the console.
     * @private
     * @param  {Array} msgParts - Array of strings to log.
     */
    this._log = function (msgParts) {
      if (settings.display) {
        if (console && console.log) {
          console.log.apply(console.log, msgParts);
        }
      }
    };

    /**
     * Log method definition.
     * @private
     * @param  {Object} level - Reference to the level definition.
     * @param  {Array} args - The arguments received by the log method.
     */
    this._execute = function (level, args) {

      var date = new Date();
      var text = '';
      var meta = void 0;

      args = Array.prototype.slice.call(args, 0);
      for (var i=0; i<args.length; i++) {
        if (typeof args[i] === 'function') {
          // Functions are not used.
        } else if (i === args.length - 1 && Object(args[i]) === args[i]) {
          meta = args[i];
        } else {
          text += ' '+ args[i];
        }
      }
      text = text.trim();

      this._record(date, level, text, meta);

      if (settings.throwErrors && level.priority <= 0) {
        throw new Error(text);
      }

      if (level.priority <= settings.priority) {

        var prefix = this._prefix(date, level);
        var msgParts = [text];

        if (prefix.length) {
          if (settings.colors && level.color) {
            if (isNode) {
              msgParts = [level.color.node + prefix + NODE_COLOR_END +' '+ text];
            } else {
              msgParts = ['%c'+ prefix +' %c'+ text, level.color.browser, BROWSER_COLOR_END];
            }
          } else {
            msgParts = [prefix +' '+ text];
          }
        }

        this._log(msgParts);
      }
    };
  }
310897
function (msg) {
            var config = this._config;
            this.$logError.apply(this, msg);
            if (config.onerror) {
                this.$callback(config.onerror, msg);
            }
        }
808869
function(inst, name) {
		return inst.settings[name] !== undefined ?
			inst.settings[name] : this._defaults[name];
	}
934548
def __parse_namespace(self):
        
        if self.manifest.has_option('config', 'namespace'):
            return self.manifest.get('config', 'namespace')
        elif self.manifest.has_option('config', 'source'):
            return NAMESPACE_REGEX.search(self.manifest.get('config', 'source')).groups()[0]
        else:
            logger.warn('Could not parse namespace implicitely')
            return None
1142170
public final void nameSpace (String namespace) {
    if (namespace == null || namespace.equals("")) {
      _namespace = "";
    } else {
      _namespace = namespace + ":";
    }
  }
1316145
function init(config){
    var logger = new LogglyLogger(config);
    logger.validateConfig();

    logger.config = config;
    logger.client = loggly.createClient({
        token: config.token,
        subdomain: config.application,
        auth: config.auth,

        // TOOD: pushing more tags onto this array, or not using them, should be configurable
        tags: [
            config.domain,
            config.machine
        ]

        // Loggly docs say it uses json stringify if json:true
        // JSON stringify does not handle Errors or circulare references well
        // Logger.createEntry handles them well
    });
    return logger;
}
201357
function( name, method ) {
			var m = this.settings.messages[name];
			return m && (m.constructor === String ? m : m[method]);
		}
1046802
function(namespace, handler) {
            if (Logger.namespaces[namespace] == null) {
                Logger.namespaces[namespace] = new Logger({
                    namespace: namespace,
                    handler: handler
                });
            }
            return Logger.namespaces[namespace];
        }
249747
function(text, settings) {
            var that = this;
            settings = settings || {};

            var getTypeId = settings.getTypeId || function(object) { return that.getTypeId(object); };
            var getConstructor = settings.getConstructor || function(id) { return that.typeMap[id]; };
            var reviver = settings.reviver || function(key, value) { return that.reviver(key, value, getTypeId, getConstructor); };

            return JSON.parse(text, reviver);
        }
447269
function Logger(opt) {
    var self = {};

    var defaultOptions = {
        name: 'gina', // by default
        template: '%d [ %s ] %m',
        //containers: [],
        levels : { // based on Sylog Severity Levels
            emerg: {
                code: 0,
                label: 'Emergency',
                desciption: 'System is unusable.',
                color: 'red'
            },
            alert: {
                code: 1,
                label: 'Alert',
                desciption: 'Action must be taken immediately.',
                color:'red'
            },

            crit: {
                code: 2,
                label: 'Critical',
                desciption: 'Critical conditions.',
                color: 'red'
            },
            error : {
                code: 3,
                label: 'Error',
                desciption: 'Error conditions.',
                color : 'orange'
            },
            warn : {
                code: 4,
                label: 'Warning',
                desciption: 'Warning conditions.',
                color: 'yellow'
            },
            notice: {
                code: 5,
                label: 'Notice',
                desciption: 'Normal but significant condition.',
                color: 'yellow'
            },
            info : {
                code: 6,
                label: 'Informational',
                desciption: 'Informational messages.',
                color: 'blue'
            },
            debug : {
                code: 7,
                label: 'Debug',
                desciption: 'Debug-level messages.',
                color: 'cyan'
                //'format' : '',
                //'pipe' : []
            }

        }
    };

    if (opt) {
        opt = merge(defaultOptions, opt, true)
    } else {
        opt = defaultOptions
    }

    /**
     * init
     * @constructor
     * */
    var init = function(opt) {
        if ( typeof(Logger.initialized) != "undefined" ) {
            console.debug("Logger instance already exists. Loading it.");
            return getInstance(opt)
        } else {
            Logger.initialized = true;
            Logger.instance = self;
            setDefaultLevels();
        }
    }

    var getInstance = function(opt) {
        return Logger.instance
    }

    var setDefaultLevels = function() {

        for (var l in opt.levels) {
            if ( typeof(self[l]) != 'undefined' )
                delete self[l];

            //self[l] = new Function('return '+write+'('+JSON.stringify(opt)+', '+parse+', "'+l+'", arguments);');
            self[l] = new Function('this._log_printed = false; process.stdout.write('+write+'('+JSON.stringify(opt)+', '+parse+', "'+l+'", arguments));');
        }
    }

    var write = function(opt, parse, s, args) {

        if ( /^(debugger listening on port)/.test(args[0])
            && typeof(opt.levels.info) != 'undefined'
        ) {
            s = 'info'
        }
        //process.stdout.write('\n'+ "LOGGER ACTION ? "+ s + ": ("+args.length+") ["+ args[0]+ "]");
        var content = '';
        //To handle logs with coma separated arguments.
        for (var i=0; i<args.length; ++i) {
            if (args[i] instanceof Function) {
                content += args[i].toString() + ''
            } else if (args[i] instanceof Object) {
                // careful, [ parse ] will be out of the main execution context: passing it for recursive use
                content += parse(parse, args[i], '')
            } else {
                //if ( args[i].replace(/\s/g, '') != '')
                //process.stdout.write('\n'+ ("=>> [" + args[i] + "]"));
                content += args[i] + ' '
            }
        }

        if (content != '' && !this._log_printed) {
            var now = new Date();
            var repl = {
                '%s': s, //severity
                '%d': now, // timestamp
                '%m': content // message
                //'%container', //container
            };

            var patt = opt.template.match(/\%[a-z A-Z 0-9]/g);
            content = opt.template;
            for(var p=0; p<patt.length; ++p) {
                content = content.replace(new RegExp(patt[p], 'g'), repl[patt[p]]);
            }

            //return process.stdout.write('\n'+ content)
            this._log_printed = true;
            return '\n'+ content
        }

        this._log_printed = false;
        return content
    }

    var parse = function(parse, obj, str) {
        var l = 0
            , len = obj.count()
            , isArray = (obj instanceof Array) ? true : false;
        str += (isArray) ? '[ ' : '{';

        for (var attr in obj) {
            ++l;
            if (obj[attr] instanceof Function) {
                str += attr +': [Function]';
                // if you want ot have it all replace by the fllowing line
                //str += attr +':'+ obj[attr].toString();
                str += (l<len) ? ', ' : ''
            } else if (obj[attr] instanceof Object && !isArray) {
                str += '"'+attr+'": ';
                str = parse(parse, obj[attr], str);
                str += (l<len) ? ', ' : '';
            } else {
                if (!isArray && typeof(obj[attr]) == 'string') {
                    str += '"'+attr+'": "' + obj[attr]
                            .replace(/\'/g, "\\'")
                            .replace(/\"/g, '\\"') +'"';
                } else if (isArray) {
                    str += ( typeof(obj[attr]) != 'string' ) ? obj[attr] : '"'+ obj[attr] +'"'
                } else {
                    str += '"'+attr+'": ' + obj[attr]
                }
                str += (l<len) ? ', ' : ''
            }
        }

        str += (isArray) ? ' ]' : '}';
        return str + ' '
    }

//    /**
//     * Add or override existing level(s)
//     * @param {object} levels
//     * */
//    this.addLevel = function(levels) {
//        for (var l in levels) {
//            self[l] = new Function('return '+write+'('+JSON.stringify(opt)+', "'+l+'", arguments);');
//        }
//    }

    self.setLevels = function(levels) {
        try {
            //remove default.
            for (var l in opt.levels) {
                delete self[l]
            }


            for (var l in levels) {
                self[l] = new Function('return '+write+'('+JSON.stringify(opt)+', '+parse+', "'+l+'", arguments);');
            }
        } catch(e) {
            setDefaultLevels();
            self.error('Cannot set type: ', e.stack|| e.message)
        }
    }

    self.getLogger = function(details) {
        console.debug('getting logger')
    }

    self.log = function() {
        var args = arguments, content = '';
        //console.log("arg: ", args);
        //To handle logs with coma speparated arguments.
        for (var i=0; i<args.length; ++i) {

            if (args[i] instanceof Object) {
                //console.log("\n...", args[i], args[i].toString());
                content += JSON.stringify(args[i], null, '\t')
            } else {
                content += args[i]
            }
        }
        //process.stdout.write('\n'+ "hum ? "+ content);
        //console.log("hum ? ", content);
        if (content != '')
            process.stdout.write('\n'+ content)
    }


    init(opt);
    return self
}
1243585
function Logger(options)
{
  /**
   * The array to which all log messages will be added.
   *
   * @type {String[]}
   */
  var buffer = [];

  /**
   * Logs a message at a given level.
   *
   * @param {String} levelTag the tag associated with the level at which to log
   *   the message.
   * @param {String} message the message to log.
   * @param {Number} bufferMaxLength the maximum size to which the message
   *   buffer can grow.
   */
  var logMessage = function(levelTag, message, bufferMaxLength)
  {
    // add the log level tag (e.g. info, warn, etc.) to the front of the message
    message = Util.format('%s: %s', levelTag, message);

    // if the buffer is full, evict old messages
    while (buffer.length >= bufferMaxLength)
    {
      buffer.shift();
    }

    // add the new message to the buffer
    buffer.push(message);
  };

  // create an inner implementation to which all our methods will be forwarded
  var common = Core.createLogger(options, logMessage);

  /**
   * Configures this logger.
   *
   * @param {Object} options
   */
  this.configure = function(options)
  {
    common.configure(options);
  };

  /**
   * Returns the current log level.
   *
   * @returns {Number}
   */
  this.getLevel = function()
  {
    return common.getLevelNumber();
  };

  /**
   * Logs a given message at the error level.
   *
   * @param {String} message
   */
  this.error = function(message)
  {
    common.error.apply(common, arguments);
  };

  /**
   * Logs a given message at the warning level.
   *
   * @param {String} message
   */
  this.warn = function(message)
  {
    common.warn.apply(common, arguments);
  };

  /**
   * Logs a given message at the info level.
   *
   * @param {String} message
   */
  this.info = function(message)
  {
    common.info.apply(common, arguments);
  };

  /**
   * Logs a given message at the debug level.
   *
   * @param {String} message
   */
  this.debug = function(message)
  {
    common.debug.apply(common, arguments);
  };

  /**
   * Logs a given message at the trace level.
   *
   * @param {String} message
   */
  this.trace = function(message)
  {
    common.trace.apply(common, arguments);
  };

  /**
   * Returns the log buffer.
   *
   * @returns {String[]}
   */
  this.getLogBuffer = function()
  {
    // return a copy of the buffer array; calling slice() shallow-copies the
    // original array, but that's sufficient in this case because the array
    // contains strings
    return buffer.slice();
  };
}
1307305
function configure_logging() {
  if ('log' in CONF) {

    if ('plugin' in CONF.log) { process.env.NODE_LOGGER_PLUGIN = CONF.log.plugin; }
    if ('level'  in CONF.log) { process.env.NODE_LOGGER_LEVEL  = CONF.log.level; }

    if ('customlevels' in CONF.log) {
      for (var key in CONF.log.customlevels) {
        process.env['NODE_LOGGER_LEVEL_' + key] = CONF.log.customlevels[key];
      }
    }
  }
}
774846
def parse(settings, logfile = nil)
      settings.each do |key, value|
        if value.is_a?(Hash)
          logfile = Logmsg::LogFile.new(key)
          logfiles[key.to_sym] = logfile
          parse(value, logfile)
          logfile.register
        else
          logfile.public_send("#{key}=", value)
        end
      end
    end
1078312
function LoggerContext(logger, module) {
  if (!(this instanceof LoggerContext))
    return new LoggerContext(logger, module);

  assert(typeof module === 'string');

  this.logger = logger;
  this.module = module;
}
1237644
function ( namespace) {
    
    var this_axon = this;

    //setup parent
    events.EventEmitter.call(this_axon);
    
    this_axon.namespace = namespace;

    //setup our events, bind functions
    this_axon.on('data', this_axon.fire.bind( this_axon ) );    
    this_axon.on('error', this_axon.misfire.bind( this_axon ) );
    
}
761686
function Config( defaults, extend, envName )
{
  // Constants
  // -------------

  // test instance uniqueness
  this._UID         = _.uniqueId('config_')

  this._DEFAULTENV  = 'default'


  // CORE's settings
  // ------------------------

  // default app configuration
  var confDefault = this.getConfigParam( defaults )
    , confExtend  = ( !_.isUndefined( extend ) )
                    ? this.getConfigParam( extend )
                    : {}

  this._ENV    = envName || this._DEFAULTENV
  this._CONFIG = _.merge(
        {}
      , confDefault
      , confExtend
    )

  return this
}
1348065
function (settings) {

    let out = '';
    if (settings.securityDefinitions) {
        Object.keys(settings.securityDefinitions).forEach((key) => {

            if (settings.securityDefinitions[key]['x-keyPrefix']) {
                out = settings.securityDefinitions[key]['x-keyPrefix'];
            }
        });
    }
    return out;
}