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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9758e89d9fe8fbbd43e02e8ec5444983630f0111
4
- data.tar.gz: 10373e2f8c954c8ddec61e858e5997fb1f154789
3
+ metadata.gz: e8e992520d6ea4d99f620cf37d8173b4ac8fd6b5
4
+ data.tar.gz: 902f487e2f6d6917b458313e3dd4d353051c39ae
5
5
  SHA512:
6
- metadata.gz: 748c8e6774fa8d844f86bb779fad56544e08e20e83e8d783333eb252e5d12a15f49ca3341d06b0e745f672cb5db14471b4e687559becbdc3165f47a895702c81
7
- data.tar.gz: 9d8e727dfaea81cbeac21c08a323ac366784f10dd38064f21b117a968f85e881434362cc4dff48093fe93e99fb0e9b868ee8ec2726f44c1d5fb465bbd2f48dbf
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 = caller[ 1 ].split( '/' ).last
82
+ previous = most_recent_caller
72
83
  parts = previous.split( /[\.|:]/ )
73
84
  method = previous.split( /`/ ).last.gsub( "'", "" )
74
85
 
@@ -1,3 +1,3 @@
1
1
  module EnhancedLogger
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enhanced-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Ulmer