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

Add a new log priority: important. Should make it easier to display interesting non-error messages.

This commit is contained in:
Simo Kinnunen 2014-06-02 12:19:52 +09:00
parent 1095c1ba97
commit 97c4d24a7a
4 changed files with 52 additions and 32 deletions

View file

@ -9,18 +9,21 @@ Logger.Level = {
DEBUG: 1
, VERBOSE: 2
, INFO: 3
, WARNING: 4
, ERROR: 5
, FATAL: 6
, IMPORTANT: 4
, WARNING: 5
, ERROR: 6
, FATAL: 7
}
// Exposed for other modules
Logger.LevelLabel = {
1: 'DBG'
, 2: 'VRB'
, 3: 'INF'
, 4: 'WRN'
, 5: 'ERR'
, 6: 'FTL'
, 4: 'IMP'
, 5: 'WRN'
, 6: 'ERR'
, 7: 'FTL'
}
Logger.globalIdentifier = '*'
@ -40,17 +43,19 @@ function Log(tag) {
1: 'DBG'
, 2: 'VRB'
, 3: 'INF'
, 4: 'WRN'
, 5: 'ERR'
, 6: 'FTL'
, 4: 'IMP'
, 5: 'WRN'
, 6: 'ERR'
, 7: 'FTL'
}
this.styles = {
1: 'grey'
, 2: 'cyan'
, 3: 'green'
, 4: 'yellow'
, 5: 'red'
, 4: 'magenta'
, 5: 'yellow'
, 6: 'red'
, 7: 'red'
}
this.localIdentifier = null
events.EventEmitter.call(this)
@ -83,6 +88,10 @@ Log.prototype.info = function() {
this._write(this._entry(Logger.Level.INFO, arguments))
}
Log.prototype.important = function() {
this._write(this._entry(Logger.Level.IMPORTANT, arguments))
}
Log.prototype.warn = function() {
this._write(this._entry(Logger.Level.WARNING, arguments))
}