mirror of
https://github.com/openstf/stf
synced 2025-10-03 17:59:28 +02:00
Expose logger levels.
This commit is contained in:
parent
e424e59daf
commit
cc31ea2ad5
1 changed files with 15 additions and 14 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue