enhanced-logger 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/enhanced_logger/logger.rb +13 -2
- data/lib/enhanced_logger/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8e992520d6ea4d99f620cf37d8173b4ac8fd6b5
|
4
|
+
data.tar.gz: 902f487e2f6d6917b458313e3dd4d353051c39ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2565dfbb3d10551fb9fcf6c7da44626134eef02208492c4699a6df208f818b02c71e254f7b2e4377d77ff0e55339e8f6972136b217cc41ee8ad3a10d6a0908fc
|
7
|
+
data.tar.gz: b051cdc8fd1dfd94cb3d403daeb7658dd0673c7ac941934c3fd2e298f3e5b6d42746bb4355028e8bc6a319dce929a35b316465e27e6117925028286cd2d4014e
|
@@ -4,8 +4,9 @@ module EnhancedLogger
|
|
4
4
|
|
5
5
|
attr_accessor :level
|
6
6
|
|
7
|
-
def initialize level=1
|
7
|
+
def initialize level=1, params={}
|
8
8
|
@level = level
|
9
|
+
@exclude_files = Array( params[ :exclude_files ]).push filename
|
9
10
|
$stdout.sync = true
|
10
11
|
end
|
11
12
|
|
@@ -64,11 +65,21 @@ module EnhancedLogger
|
|
64
65
|
''
|
65
66
|
end
|
66
67
|
|
68
|
+
def most_recent_caller
|
69
|
+
regex_str = '[' + @exclude_files.join( '|' ) + ']'
|
70
|
+
|
71
|
+
caller.find{| c | c !~ %r+#{ regex_str }\.rb+ }.split( '/' ).last
|
72
|
+
end
|
73
|
+
|
67
74
|
|
68
75
|
private
|
69
76
|
|
77
|
+
def filename
|
78
|
+
File.basename( __FILE__ ).gsub '.rb', ''
|
79
|
+
end
|
80
|
+
|
70
81
|
def formatted msg
|
71
|
-
previous =
|
82
|
+
previous = most_recent_caller
|
72
83
|
parts = previous.split( /[\.|:]/ )
|
73
84
|
method = previous.split( /`/ ).last.gsub( "'", "" )
|
74
85
|
|