enhanced-logger 0.2.0 → 0.2.2

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: 4b5001d91ed29d8b56e9e6d13f85b7b549d381c4
4
- data.tar.gz: 4f10b05e495d9adf5d34322329d66e304565321c
3
+ metadata.gz: 4152a2c0c4f80abfb8a63aec842a37ac693cb120
4
+ data.tar.gz: d5bf1ffe025e7525a9c26b1bd3beed5d64aef4bc
5
5
  SHA512:
6
- metadata.gz: 60173ff1c3ca9ce3ddabc84f1977cb19e070f3945db9362d0a0a8c0e562d01fe787df4d0fdf696422749ac4ae68ed0ddc5d5e884e16925d09450d541034b3a24
7
- data.tar.gz: 64596c4f0c23280f145d2da644dcd08d6e1c4ea4905e2c9ab65118014de90824605acf344e833691418999d1f8067ef24c52786c9e58bc82c8417b524b9b687b
6
+ metadata.gz: 80c63839069ff59fd527309623f195f13985cc6b789e2751d56fcdbc836ae0b30467b5660132754ebe3998bfd7c678de52e5e87fdecf3c607d9a052618399eca
7
+ data.tar.gz: bd66ad0ac0cbf419deac487719d71f9aa94a600f163c98c7ee06b0b0f09c7c64869e015bac86180063a9f5a2c93eacff318c3fae9cc080575efcffdc51d4df78
@@ -1,13 +1,12 @@
1
1
  require 'enhanced_logger/logger'
2
2
 
3
-
4
- module EnhancedLogger
3
+ module EnhancedLogger
5
4
  require 'enhanced_logger/logger'
6
-
5
+
7
6
  if defined?(Rails)
8
7
  else
9
8
  # require 'our_gem/difficult_stuff'
10
9
  end
11
10
  end
12
11
 
13
- puts 'Loading Enhanced Logger.'
12
+ puts 'Loading Enhanced Logger.'
@@ -46,24 +46,28 @@ module EnhancedLogger
46
46
  @level <= LEVELS[ :fatal ]
47
47
  end
48
48
 
49
-
50
49
  def debug msg=nil
50
+ return if is_not_a_message?( msg )
51
51
  puts formatted( msg ) if debug?
52
52
  end
53
53
 
54
54
  def info msg=nil
55
+ return if is_not_a_message?( msg )
55
56
  puts formatted( msg ) if info?
56
57
  end
57
58
 
58
59
  def warn msg=nil
60
+ return if is_not_a_message?( msg )
59
61
  puts formatted( msg ) if warn?
60
62
  end
61
63
 
62
64
  def error msg=nil
65
+ return if is_not_a_message?( msg )
63
66
  puts formatted( msg ) if error?
64
67
  end
65
68
 
66
69
  def fatal msg=nil
70
+ return if is_not_a_message?( msg )
67
71
  puts formatted( msg ) if fatal?
68
72
  end
69
73
 
@@ -73,13 +77,18 @@ module EnhancedLogger
73
77
 
74
78
  def most_recent_caller
75
79
  regex_str = '[' + @options[ :exclude_files ].join( '|' ) + ']'
76
-
77
- caller.find{| c | c !~ %r+#{ regex_str }\.rb+ }.split( '/' ).last
80
+
81
+ filtered = caller.find{| c | c !~ %r+#{ regex_str }\.rb+ }
82
+ filtered.nil? ? '' : filtered.split( '/' ).last
78
83
  end
79
84
 
80
85
 
81
86
  private
82
87
 
88
+ def is_not_a_message?( msg )
89
+ msg.nil? || msg.is_a?( String ) && msg.empty?
90
+ end
91
+
83
92
  def filename
84
93
  File.basename( __FILE__ ).gsub '.rb', ''
85
94
  end
@@ -99,4 +108,4 @@ module EnhancedLogger
99
108
  @options[ :uuid_log_length ] || MAX_UUID_LENGTH
100
109
  end
101
110
  end
102
- end
111
+ end
@@ -1,3 +1,3 @@
1
1
  module EnhancedLogger
2
- VERSION = "0.2.0"
3
- end
2
+ VERSION = "0.2.2"
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.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Ulmer
@@ -9,7 +9,21 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-01-29 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.5.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.5.0
13
27
  description: Logs extra info.
14
28
  email: george@boost-media.com
15
29
  executables: []
@@ -39,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
53
  version: '0'
40
54
  requirements: []
41
55
  rubyforge_project:
42
- rubygems_version: 2.5.1
56
+ rubygems_version: 2.6.4
43
57
  signing_key:
44
58
  specification_version: 4
45
59
  summary: Enhanced Logger