feat: add system level
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
57926ba788
commit
46925f9b52
@ -17,9 +17,12 @@ var global = this;
|
||||
global.debug = true;
|
||||
}
|
||||
if (java.nio.file.Files.exists(java.nio.file.Paths.get(root, "debug"))) {
|
||||
logger.info('Running debugging mode...');
|
||||
logger.info('Running in debug mode...');
|
||||
global.debug = true;
|
||||
global.trace = true;
|
||||
}
|
||||
if (java.nio.file.Files.exists(java.nio.file.Paths.get(root, "level"))) {
|
||||
global.level = base.read(java.nio.file.Paths.get(root, "level"))
|
||||
logger.info('Set system level to [' + global.level + ']...');
|
||||
}
|
||||
// Check Class Loader, Sometimes Server will can't find plugin.yml file
|
||||
loader = checkClassLoader();
|
||||
|
@ -1,7 +1,15 @@
|
||||
(function(logger) {
|
||||
// @ts-check
|
||||
(
|
||||
/**
|
||||
* @param {{ info: (arg0: string) => void; }} logger
|
||||
*/
|
||||
function(logger) {
|
||||
function log() {
|
||||
logger.info(Array.prototype.join.call(arguments, ' '))
|
||||
}
|
||||
/**
|
||||
* @param {string} prefix
|
||||
*/
|
||||
function _proxy(prefix) {
|
||||
return function() {
|
||||
log('[' + prefix + ']', Array.prototype.join.call(arguments, ' '))
|
||||
@ -11,7 +19,9 @@
|
||||
log: log,
|
||||
info: log,
|
||||
ex: log,
|
||||
trace: global.trace ? _proxy('TRACE') : global.noop,
|
||||
// @ts-ignore
|
||||
trace: global.level === "trace" ? _proxy('TRACE') : global.noop,
|
||||
// @ts-ignore
|
||||
debug: global.debug ? _proxy('DEBUG') : global.noop,
|
||||
warn: _proxy('WARN'),
|
||||
error: _proxy('ERROR')
|
||||
|
Loading…
Reference in New Issue
Block a user