logem 0.2.0 → 0.3.0

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/logem/logger.rb +9 -9
  3. data/logem.gemspec +1 -1
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -7,30 +7,30 @@ module Logem
7
7
  DEBUG = 20
8
8
  TRACE = 10
9
9
 
10
- DEFAULT_VISIBLE_LEVEL = INFO
10
+ DEFAULT_LEVEL = INFO
11
11
  DEFAULT_LOG_LEVEL_ENV = "LOGEM_LOG_LEVEL"
12
12
 
13
13
  attr :log_level_env
14
14
  attr :context
15
- attr_accessor :visible_level
15
+ attr_accessor :level
16
16
 
17
17
  def initialize context, options = {}
18
18
  @context = context
19
19
  @log_level_env = options[:log_level_env ] || DEFAULT_LOG_LEVEL_ENV
20
- @visible_level = options[:visible_level ] || self.class.string_to_level(ENV[@log_level_env]) || DEFAULT_VISIBLE_LEVEL
20
+ @level = options[:level ] || self.class.string_to_level(ENV[@log_level_env]) || DEFAULT_LEVEL
21
21
  @output = options[:output ] || $stdout
22
22
  @time_formatter = options[:time_formatter]
23
23
  @output_supports_logem = @output.respond_to? :logem
24
24
  end
25
25
 
26
26
  def log level, *args
27
- return if @visible_level > level
27
+ return if @level > level
28
28
 
29
29
  _log_ level, *args
30
30
  end
31
31
 
32
32
  def visible? level
33
- @visible_level <= level
33
+ @level <= level
34
34
  end
35
35
 
36
36
  def self.level_to_string level
@@ -45,7 +45,7 @@ module Logem
45
45
  end
46
46
 
47
47
  def self.string_to_level level_string
48
- return DEFAULT_VISIBLE_LEVEL if level_string.nil? or level_string.strip == ''
48
+ return DEFAULT_LEVEL if level_string.nil? or level_string.strip == ''
49
49
 
50
50
  case level_string.strip.downcase
51
51
  when 'error' then ERROR
@@ -55,8 +55,8 @@ module Logem
55
55
  when 'trace' then TRACE
56
56
  else
57
57
  $stdout.puts "Logem warning: #{level_string} is not a valid log level, " +
58
- "default to #{level_to_string(DEFAULT_VISIBLE_LEVEL).strip}"
59
- DEFAULT_VISIBLE_LEVEL
58
+ "default to #{level_to_string(DEFAULT_LEVEL).strip}"
59
+ DEFAULT_LEVEL
60
60
  end
61
61
  end
62
62
 
@@ -64,7 +64,7 @@ module Logem
64
64
  level = string_to_level(level_str)
65
65
 
66
66
  define_method level_str do |*args|
67
- return if @visible_level > level
67
+ return if @level > level
68
68
 
69
69
  _log_ level, *args
70
70
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "logem"
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Guoliang Cao"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: -2119636713617820871
118
+ hash: -2636841020204959601
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements: