mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
Expose logger levels.
This commit is contained in:
@@ -5,14 +5,6 @@ var colors = require('colors')
|
||||
|
||||
function Log(tag, stream) {
|
||||
this.tag = tag
|
||||
this.levels = {
|
||||
DEBUG: 1
|
||||
, VERBOSE: 2
|
||||
, INFO: 3
|
||||
, WARNING: 4
|
||||
, ERROR: 5
|
||||
, FATAL: 6
|
||||
}
|
||||
this.names = {
|
||||
1: 'DBG'
|
||||
, 2: 'VRB'
|
||||
@@ -49,27 +41,27 @@ Log.prototype.setLocalIdentifier = function(identifier) {
|
||||
}
|
||||
|
||||
Log.prototype.debug = function() {
|
||||
this._write(this._entry(this.levels.DEBUG, arguments))
|
||||
this._write(this._entry(Logger.Level.DEBUG, arguments))
|
||||
}
|
||||
|
||||
Log.prototype.verbose = function() {
|
||||
this._write(this._entry(this.levels.VERBOSE, arguments))
|
||||
this._write(this._entry(Logger.Level.VERBOSE, arguments))
|
||||
}
|
||||
|
||||
Log.prototype.info = function() {
|
||||
this._write(this._entry(this.levels.INFO, arguments))
|
||||
this._write(this._entry(Logger.Level.INFO, arguments))
|
||||
}
|
||||
|
||||
Log.prototype.warn = function() {
|
||||
this._write(this._entry(this.levels.WARNING, arguments))
|
||||
this._write(this._entry(Logger.Level.WARNING, arguments))
|
||||
}
|
||||
|
||||
Log.prototype.error = function() {
|
||||
this._write(this._entry(this.levels.ERROR, arguments))
|
||||
this._write(this._entry(Logger.Level.ERROR, arguments))
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -105,6 +97,15 @@ Log.prototype._write = function(entry) {
|
||||
|
||||
var Logger = new events.EventEmitter()
|
||||
|
||||
Logger.Level = {
|
||||
DEBUG: 1
|
||||
, VERBOSE: 2
|
||||
, INFO: 3
|
||||
, WARNING: 4
|
||||
, ERROR: 5
|
||||
, FATAL: 6
|
||||
}
|
||||
|
||||
Logger.globalIdentifier = '*'
|
||||
|
||||
Logger.createLogger = function(tag) {
|
||||
|
||||
Reference in New Issue
Block a user