@freemework/common
Version:
Common library of the Freemework Project.
51 lines • 1.78 kB
JavaScript
import { FExceptionArgument } from "../exception/f_exception_argument.js";
const _trace = "TRACE";
const _debug = "DEBUG";
const _info = "INFO";
const _warn = "WARN";
const _error = "ERROR";
const _fatal = "FATAL";
export class FLoggerLevel extends Object {
_textValue;
_intValue;
static TRACE = new FLoggerLevel(_trace, 6);
static DEBUG = new FLoggerLevel(_debug, 5);
static INFO = new FLoggerLevel(_info, 4);
static WARN = new FLoggerLevel(_warn, 3);
static ERROR = new FLoggerLevel(_error, 2);
static FATAL = new FLoggerLevel(_fatal, 1);
static parse(value) {
switch (value) {
case _trace:
return FLoggerLevel.TRACE;
case _debug:
return FLoggerLevel.DEBUG;
case _info:
return FLoggerLevel.INFO;
case _warn:
return FLoggerLevel.WARN;
case _error:
return FLoggerLevel.ERROR;
case _fatal:
return FLoggerLevel.FATAL;
default:
throw new FExceptionArgument(`Cannot parse '${value}' as '${FLoggerLevel.name}'`);
}
}
valueOf() {
return this._intValue;
}
// bool operator > (FLoggerLevel other) => this._intValue > other._intValue;
// bool operator >= (FLoggerLevel other) => this._intValue >= other._intValue;
// bool operator < (FLoggerLevel other) => this._intValue < other._intValue;
// bool operator <= (FLoggerLevel other) => this._intValue <= other._intValue;
toString() {
return this._textValue;
}
constructor(_textValue, _intValue) {
super();
this._textValue = _textValue;
this._intValue = _intValue;
}
}
//# sourceMappingURL=f_logger_level.js.map