semlogger 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/semlogger.rb +14 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/lib/semlogger.rb
CHANGED
@@ -28,6 +28,8 @@ end
|
|
28
28
|
|
29
29
|
class Semlogger < ::Logger
|
30
30
|
class CustomType
|
31
|
+
attr_accessor :logger
|
32
|
+
|
31
33
|
def initialize name, *obj
|
32
34
|
@name, @obj = name.to_s.to_sym, obj
|
33
35
|
end
|
@@ -35,19 +37,26 @@ class Semlogger < ::Logger
|
|
35
37
|
def to_semlogger
|
36
38
|
[@name] + @obj
|
37
39
|
end
|
40
|
+
|
41
|
+
def add severity, progname = nil, &block
|
42
|
+
@logger.add severity, self, progname = nil, &block
|
43
|
+
end
|
44
|
+
::Semlogger::Severity.constants.each do |severity|
|
45
|
+
module_eval "def #{severity.downcase}( *a, &e) add #{::Semlogger::Severity.const_get severity}, *a, &e end", __FILE__, __LINE__
|
46
|
+
end
|
38
47
|
end
|
39
48
|
|
40
49
|
attr_accessor :logdev, :level, :progname
|
41
50
|
class <<self
|
42
51
|
attr_accessor :progname
|
43
52
|
|
44
|
-
def custom *a
|
45
|
-
CustomType.new *a
|
46
|
-
end
|
53
|
+
def custom( *a) CustomType.new *a end
|
47
54
|
end
|
48
55
|
|
49
56
|
def custom *a
|
50
|
-
CustomType.new *a
|
57
|
+
r = CustomType.new *a
|
58
|
+
r.logger = self
|
59
|
+
r
|
51
60
|
end
|
52
61
|
|
53
62
|
@@progname = nil
|
@@ -60,7 +69,7 @@ class Semlogger < ::Logger
|
|
60
69
|
@level, @data, @tags, @logdev = DEBUG, {}, [], logdev
|
61
70
|
end
|
62
71
|
|
63
|
-
def tagged tags, &e
|
72
|
+
def tagged *tags, &e
|
64
73
|
@tags += tags
|
65
74
|
tags = tags.size
|
66
75
|
yield
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Denis Knauf
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-
|
17
|
+
date: 2012-10-15 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|