1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00

Expose logger levels.

This commit is contained in:
Simo Kinnunen 2014-01-29 21:20:29 +09:00
parent e424e59daf
commit cc31ea2ad5

View file

@ -5,14 +5,6 @@ var colors = require('colors')
function Log(tag, stream) { function Log(tag, stream) {
this.tag = tag this.tag = tag
this.levels = {
DEBUG: 1
, VERBOSE: 2
, INFO: 3
, WARNING: 4
, ERROR: 5
, FATAL: 6
}
this.names = { this.names = {
1: 'DBG' 1: 'DBG'
, 2: 'VRB' , 2: 'VRB'
@ -49,27 +41,27 @@ Log.prototype.setLocalIdentifier = function(identifier) {
} }
Log.prototype.debug = function() { Log.prototype.debug = function() {
this._write(this._entry(this.levels.DEBUG, arguments)) this._write(this._entry(Logger.Level.DEBUG, arguments))
} }
Log.prototype.verbose = function() { Log.prototype.verbose = function() {
this._write(this._entry(this.levels.VERBOSE, arguments)) this._write(this._entry(Logger.Level.VERBOSE, arguments))
} }
Log.prototype.info = function() { Log.prototype.info = function() {
this._write(this._entry(this.levels.INFO, arguments)) this._write(this._entry(Logger.Level.INFO, arguments))
} }
Log.prototype.warn = function() { Log.prototype.warn = function() {
this._write(this._entry(this.levels.WARNING, arguments)) this._write(this._entry(Logger.Level.WARNING, arguments))
} }
Log.prototype.error = function() { Log.prototype.error = function() {
this._write(this._entry(this.levels.ERROR, arguments)) this._write(this._entry(Logger.Level.ERROR, arguments))
} }
Log.prototype.fatal = function() { Log.prototype.fatal = function() {
this._write(this._entry(this.levels.FATAL, arguments)) this._write(this._entry(Logger.Level.FATAL, arguments))
} }
Log.prototype._entry = function(priority, args) { Log.prototype._entry = function(priority, args) {
@ -105,6 +97,15 @@ Log.prototype._write = function(entry) {
var Logger = new events.EventEmitter() var Logger = new events.EventEmitter()
Logger.Level = {
DEBUG: 1
, VERBOSE: 2
, INFO: 3
, WARNING: 4
, ERROR: 5
, FATAL: 6
}
Logger.globalIdentifier = '*' Logger.globalIdentifier = '*'
Logger.createLogger = function(tag) { Logger.createLogger = function(tag) {