logmaster 0.1.2 → 0.1.3

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: 705e9d16e0aeffce10375dc6876659d6fd912827
4
- data.tar.gz: 8b6f701e3a6de1d0bcb088c42ff63956921f1014
3
+ metadata.gz: 0e59e3dce468d8ac0ec59acc56f3d78ad2d90cbc
4
+ data.tar.gz: 94aadbfa28d80524741fdd3d89abc4dac6927fc9
5
5
  SHA512:
6
- metadata.gz: 78e1ec5cb4afe4ddc0222b992d7e7325abbd9bc52168e7acdbf8c5eb0c832b02131e71f7d20be2fc17032b4238baf905936e261e5a6c017150bf1baa34414eac
7
- data.tar.gz: 50420ca2a71175336e49daca59252abc1ec690b015547bc9ad5cdf0b8eb5998403fdbeb566851bd786eaf34d97ec993a8d9b1d09ba7736c635b53866c758956b
6
+ metadata.gz: b34476552afcd2155424f81d954435a7c859fdc4f575ce8c21b585c70b66b11bafec2944482a4fddff81c1b63431154130b8dfd5d94391240ad5e8cc3beb84e5
7
+ data.tar.gz: e7bb3957a461936f1dd91b452bca2824a683c43d45807950b4e3fd575087c29243676358dde8a14d4b536a1565e10c511f78e1c463fc520fbdd674b7614acf64
data/README.md CHANGED
@@ -29,10 +29,12 @@ Logmaster can also send emails. It uses Pony (https://github.com/benprew/pony) t
29
29
  makes use of sendmail, but you can also specify SMTP options. See Pony docs to learn more. In our
30
30
  example I will use the sendmail (which is default):
31
31
 
32
- logmaster = Logmaster.new( email_config: { to: 'me@email.foo', from: "logmaster@yourapp.com" })
32
+ logmaster = Logmaster.new( email_config: { to: 'me@email.foo', from: "logmaster@yourapp.com", log_level: :warn })
33
33
  logmaster.warn("Wow, this is another warning!")
34
34
 
35
- The second line will trigger sending an email to your address.
35
+ The second line will trigger sending an email to your address. `:log_level` option allows to set which types of
36
+ log entries are sent in an email. For example, you may want to log on log_level INFO, but only send emails
37
+ when a log entry is WARN or more critical.
36
38
 
37
39
 
38
40
  Wathcing the code for Exceptions
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/lib/logmaster.rb CHANGED
@@ -31,7 +31,7 @@ class Logmaster
31
31
  require 'pony'
32
32
  require 'erb'
33
33
 
34
- @email_config = { via: :sendmail, from: 'logmaster@localhost', subject: "#{@name} message" }
34
+ @email_config = { via: :sendmail, from: 'logmaster@localhost', subject: "#{@name} message", log_level: :warn }
35
35
 
36
36
  # Convert string keys into symbol keys
37
37
  settings = Hash[settings.map{|(k,v)| [k.to_sym,v]}]
@@ -65,7 +65,7 @@ class Logmaster
65
65
 
66
66
  if [:unknown, :fatal, :error, :warn, :info, :debug].include?(name)
67
67
 
68
- if @email_config && @log_level <= Logger.const_get(name.to_s.upcase)
68
+ if @email_config && @log_level <= Logger.const_get(@email_config[:log_level].to_s.upcase)
69
69
  send_email(type: name, message: args[0])
70
70
  end
71
71
 
data/logmaster.gemspec CHANGED
@@ -2,16 +2,16 @@
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.2 ruby lib
5
+ # stub: logmaster 0.1.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "logmaster"
9
- s.version = "0.1.2"
9
+ s.version = "0.1.3"
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"]
13
13
  s.authors = ["Roman Snitko"]
14
- s.date = "2015-01-07"
14
+ s.date = "2015-01-20"
15
15
  s.description = "A wrapper around ruby stdlib Logger with emailing capabilities"
16
16
  s.email = "roman.snitko@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -26,7 +26,7 @@ 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' })
29
+ expect(@logmaster.email_config).to eq({ via: :sendmail, from: 'logmaster@localhost', subject: "Logmaster message", to: 'your-email@here.com', log_level: :warn })
30
30
  end
31
31
 
32
32
  it "sends log messages to each logger" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logmaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Snitko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-07 00:00:00.000000000 Z
11
+ date: 2015-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pony