lager 1.0.0.1 → 1.0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/lager.rb +9 -5
  3. data/test/lager.rb +3 -3
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.1
1
+ 1.0.0.3
data/lib/lager.rb CHANGED
@@ -54,11 +54,12 @@ module Lager
54
54
  level ||= (defined?(@lager) ? @lager.level : :warn)
55
55
  @lager = Logger.new dest
56
56
  @lager.formatter = proc { |sev, time, progname, msg|
57
- line = "[#{time.strftime('%Y-%m-%d %H:%M:%S')}] #{sev.to_s.upcase}: "
58
- line << "(#{progname}) " if progname
59
- line << msg << "\n"
57
+ line = "[#{time.strftime('%Y-%m-%d %H:%M:%S')}]"
58
+ line << sev.to_s.upcase.rjust(5) << ":"
59
+ line << "(#{progname})" if progname
60
+ line << " #{msg}\n"
60
61
  }
61
- log_level level
62
+ log_level = level
62
63
  dest # don't expose @lager here
63
64
  end
64
65
 
@@ -68,7 +69,10 @@ module Lager
68
69
  #
69
70
  def log_level(level = nil)
70
71
  raise "no @lager available" unless defined?(@lager)
71
- return (self.log_level = level) if level
72
+ if level
73
+ @lager.warn { "passing an argument to log_level is deprecated" }
74
+ return self.log_level = level
75
+ end
72
76
  [:debug, :info, :warn, :error, :fatal][@lager.level] || :unknown
73
77
  end
74
78
 
data/test/lager.rb CHANGED
@@ -31,7 +31,7 @@ describe Lager do
31
31
  l = Logger.new($stderr)
32
32
  Foo.log_to l
33
33
  Foo.lager.must_equal l
34
- Foo.log_level :info
34
+ Foo.log_level = :info
35
35
  Foo.bar # does debug logging, should be silent
36
36
  Foo.lager.must_equal l
37
37
  end
@@ -39,7 +39,7 @@ describe Lager do
39
39
  it "must handle a Tempfile when provided" do
40
40
  t = Tempfile.new('lager')
41
41
  Foo.log_to t
42
- Foo.log_level :debug
42
+ Foo.log_level = :debug
43
43
  Foo.bar # does debug logging
44
44
  t.rewind
45
45
  t.read.wont_be_empty
@@ -50,7 +50,7 @@ describe Lager do
50
50
  it "must handle a path to /tmp when provided" do
51
51
  fname = '/tmp/lager.log'
52
52
  Foo.log_to fname
53
- Foo.log_level :debug
53
+ Foo.log_level = :debug
54
54
  Foo.bar # does debug logging
55
55
  Foo.log_to $stderr
56
56
  File.exists?(fname).must_equal true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.1
4
+ version: 1.0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: