-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path_.aardio
102 lines (94 loc) · 2.74 KB
/
_.aardio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//log4j index
namespace log4j
import log4j.Logger
loggerCategory = 'default'; //日志类别
logType = _STUDIO_INVOKED == null ? 'FILE':'CONSOLE' //默认在ide为console
levels = {
ALL={level=1;color = 0xf};
TRACE={level=2;color = 0x8};
DEBUG={level=3;color = 0xb};
INFO={level=4;color = 0x3};
WARN={level=5;color = 0xe};
ERROR={level=6;color = 0x4};
FATAL={level=7;color = 0xa};
MARK={level=8;color = 0x1};
OFF={level=9;color = 0xf};
}
config = {
level = "DEBUG"; //默认输出日志等级
appenders = {
default = {
type =logType; //日志输出方式
fileName = 'default'; //日志文件名 如果为空用日期做文件名
layouts = { ['type'] = 'basic'};
};
};
categories = {
default = { appenders = { 'default' };leves:"DEBUG"} //当前分类日志等级
}
}
getLogger = function(loggerCategory,logConfig){
logConfig = logConfig || config
return log4j.Logger(loggerCategory,logConfig);
}
configure = function(params){
if(params.level) config.level = params.level
for(k,v in params.appenders ){
if(config.appenders[k]) {
..table.mixr(config.appenders,v)
}else{
config.appenders[k] = v
}
}
for(k,v in params.categories){
if(config.categories[k]){
..table.mixr(config.categories,v)
}else{
config.categories[k] = v
}
}
}
/****intellisense(log4j)
levels = 日志等级{
ALL={level=1;color = 0xf};
TRACE={level=2;color = 0x8};
DEBUG={level=3;color = 0xb};
INFO={level=4;color = 0x3};
WARN={level=5;color = 0xe};
ERROR={level=6;color = 0x4};
FATAL={level=7;color = 0xa};
MARK={level=8;color = 0x1};
OFF={level=9;color = 0xf};
}
logType = 在ide为console 打包后为 file
level = !log4jLevel.
config = @logConfig={
level = "DEBUG"; /*默认输出日志等级*/
"type" = "CONSOLE"; /*默认输出方式*/
appenders = {
console = {
"type" ='CONSOLE'; /*日志输出方式 当前只有 FILE CONSOLE 两个值*/
fileName = 'default'; /*日志文件名 如果为空用日期做文件名*/
layouts = { ['type'] = 'basic'}; /*格式化选项可以参数log4j.layouts自定义,当前可选为 basic*/
};
};
categories = { /*分类输出,一个日志可以多个输出*/
default = { appenders = { 'console' };}
}
}
getLogger(loggerCategory) = @.getLogger('default',logConfig)
getLogger = \n返回log4j实例 @loggerCategory日志类型 \n config 为 log4j.config 类型可选参数,建议使用不建议默认配置因为默认配置为全局的
getLogger() = !newLog4j.
configure()=修改默认配置文件,不建议使用,
end intellisense****/
/**intellisense(!log4jLevel.)
all = @"ALL"
trace = @"TRACE"
debug = @"DEBUG"
info = @"INFO"
warn = @"WARN"
error = @"ERROR"
fatal = @"FATAL"
mark = @"MARK"
off = @"OFF"
end intellisense**/