logmaster 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3382354e0a0b2b7948f80d87e35d2661aa11621e
4
- data.tar.gz: 0828af405dfd244b51c60dcacbbd60b5fda941c9
3
+ metadata.gz: 1ce272e5aa3a718e5b0bb7663788571ea9a10182
4
+ data.tar.gz: 069f320d9876dac93e4bdbc5d11b62d23e4c03e1
5
5
  SHA512:
6
- metadata.gz: e9daff9081d45a467c37c6e366cd161cb1a7f6fe413994061f93816c9cdb70dbebb10ab613f9f329924bf5f405b8823dde66efb133883a3d1207305e500dfa9b
7
- data.tar.gz: 2c7a4d9a6674838447437f8c09d937841bebf495c972e8feb1e68f2f02941192a61f7231e03014c7dc414eeee1f9d11e3ae3948aa3793353083813e44c2f498f
6
+ metadata.gz: 919757dd7c26ef431e9a8fb8ea4aebe4d9b593adf634f2cb0daab9552c54e655693c7a0670b980a3fe6fe2dadd4c5cacb41ffeff07c27484127113b707b5b30b
7
+ data.tar.gz: a1e720193bc2c5277bead5140598c699e2a2bcd5abb2404cf5e29728ba9430fe634e3837caf39bc787fefb109059505261b9f6d1aa381f5610d51f141b55a408
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -2,7 +2,7 @@ require 'logger'
2
2
 
3
3
  class Logmaster
4
4
 
5
- attr_accessor :loggers, :log_level, :name, :email_config, :raise_exception
5
+ attr_accessor :loggers, :log_level, :name, :email_config, :raise_exception, :email_log_level
6
6
 
7
7
  def initialize(
8
8
  log_level: Logger::INFO,
@@ -43,7 +43,7 @@ class Logmaster
43
43
 
44
44
  # Because pony doesn't like some arbitrary options like log_level
45
45
  # and instead of ignorning them, throws an error.
46
- @email_log_level = @email_config[:log_level]
46
+ @email_log_level = Logger.const_get(@email_config[:log_level].to_s.upcase)
47
47
  @email_config.delete(:log_level)
48
48
 
49
49
  end
@@ -70,7 +70,7 @@ class Logmaster
70
70
 
71
71
  if [:unknown, :fatal, :error, :warn, :info, :debug].include?(name)
72
72
 
73
- if @email_config && @log_level <= Logger.const_get(@email_log_level.to_s.upcase)
73
+ if @email_config && @email_log_level <= Logger.const_get(name.to_s.upcase)
74
74
  send_email(type: name, message: args[0])
75
75
  end
76
76
 
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: logmaster 0.1.4 ruby lib
5
+ # stub: logmaster 0.1.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "logmaster"
9
- s.version = "0.1.4"
9
+ s.version = "0.1.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -26,7 +26,8 @@ describe Logmaster do
26
26
 
27
27
  it "sets email settings" do
28
28
  @logmaster.email_config = { to: 'your-email@here.com' }
29
- expect(@logmaster.email_config).to eq({ via: :sendmail, from: 'logmaster@localhost', subject: "Logmaster message", to: 'your-email@here.com', log_level: :warn })
29
+ expect(@logmaster.email_config).to eq({ via: :sendmail, from: 'logmaster@localhost', subject: "Logmaster message", to: 'your-email@here.com' })
30
+ expect(@logmaster.instance_variable_get(:@email_log_level)).to eq(Logger::WARN)
30
31
  end
31
32
 
32
33
  it "sends log messages to each logger" do
@@ -37,13 +38,12 @@ describe Logmaster do
37
38
  end
38
39
 
39
40
  it "sends emails when the log level of a log message is appropriate" do
40
- @logmaster.email_config = { to: 'your-email@here.com' }
41
- @logmaster.log_level = Logger::WARN
41
+ @logmaster.email_config = { to: 'your-email@here.com', log_level: :warn }
42
42
 
43
- expect(Pony).to receive(:mail)
43
+ expect(Pony).to receive(:mail).once
44
44
 
45
45
  @logmaster.warn("WARNING bitches!") # Should call Pony.mail
46
- @logmaster.log_level = Logger::FATAL
46
+ @logmaster.email_log_level = Logger::FATAL
47
47
  @logmaster.warn("WARNING bitches!") # This time shouldn't, log_level is wrong
48
48
  end
49
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logmaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Snitko