-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmnn_log.rb
49 lines (40 loc) · 1.31 KB
/
mnn_log.rb
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
# log for mnn
# standerd library require
require 'logger'
# log for mnn
class MnnLog < Logger
# write enabele/disable
attr_accessor :enable
# make log message
def make_message(object_id, class_name, method_name, message)
tmp = object_id.to_s
tmp += ' ' + class_name.to_s
tmp += ' ' + method_name.to_s
tmp += ' ' + message.to_s
tmp # return(tmp)
end
def debug(object_id, class_name, method_name, message)
return unless @enable
super(make_message(object_id, class_name, method_name, message))
end
def info(object_id, class_name, method_name, message)
return unless @enable
super(make_message(object_id, class_name, method_name, message))
end
def warn(object_id, class_name, method_name, message)
return unless @enable
super(make_message(object_id, class_name, method_name, message))
end
def error(object_id, class_name, method_name, message)
return unless @enable
super(make_message(object_id, class_name, method_name, message))
end
def fatal(object_id, class_name, method_name, message)
return unless @enable
super(make_message(object_id, class_name, method_name, message))
end
def unknown(object_id, class_name, method_name, message)
return unless @enable
super(make_message(object_id, class_name, method_name, message))
end
end