yell-adapters-syslog 1.2.0 → 2.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bd7a60b4277eb051c4de7a44bb33d812bd0e2f0d
4
+ data.tar.gz: 5d8e263dbce6cd9e55fe3e79e73ecd117d426304
5
+ SHA512:
6
+ metadata.gz: ba4e99cdc70ac1fdac5ea8b02ee1853eba9499e79bf50d422480ea80367b0502fe35793d723c23c989ec8746ed3a5c68cecf845663848118944b5981c4a1ed52
7
+ data.tar.gz: 79ea1ecbb64d808a9575673e6a970a23db02449f5216675f3b651213c66312e1b7de6e5ee65951bdc0313243e638e43ec8ae1aa3bea8853e6b9b8f47200e52de
@@ -169,6 +169,7 @@ module Yell #:nodoc:
169
169
 
170
170
  def to_message( m )
171
171
  message = m.to_s
172
+ message = message.dup if message.frozen?
172
173
 
173
174
  message.strip!
174
175
  message.gsub!(/%/, '%%') # syslog(3) freaks on % (printf)
@@ -1,46 +1,47 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Yell::Adapters::Syslog do
4
- let( :event ) { Yell::Event.new( 1, "Hello World" ) }
4
+ let(:logger) { Yell::Logger.new }
5
+ let(:event) { Yell::Event.new(logger, 1, "Hello World") }
5
6
 
6
7
  before do
7
8
  Syslog.close if Syslog.opened?
8
9
  end
9
10
 
10
11
  shared_examples_for "a Syslog adapter" do
11
- let( :adapter ) { Yell::Adapters::Syslog.new }
12
+ let(:adapter) { Yell::Adapters::Syslog.new }
12
13
 
13
14
  it "should call Syslog correctly" do
14
- mock( Syslog ).log( Yell::Adapters::Syslog::Severities[subject], "Hello World" )
15
+ mock(Syslog).log(Yell::Adapters::Syslog::Severities[subject], "Hello World")
15
16
 
16
- adapter.write Yell::Event.new( subject, "Hello World" )
17
+ adapter.write Yell::Event.new(logger, subject, "Hello World")
17
18
  end
18
19
  end
19
20
 
20
- it_behaves_like( "a Syslog adapter" ) { subject { 0 } } # debug
21
- it_behaves_like( "a Syslog adapter" ) { subject { 1 } } # info
22
- it_behaves_like( "a Syslog adapter" ) { subject { 2 } } # warn
23
- it_behaves_like( "a Syslog adapter" ) { subject { 3 } } # error
24
- it_behaves_like( "a Syslog adapter" ) { subject { 4 } } # fatal
25
- it_behaves_like( "a Syslog adapter" ) { subject { 5 } } # unknown
21
+ it_behaves_like("a Syslog adapter") { subject { 0 } } # debug
22
+ it_behaves_like("a Syslog adapter") { subject { 1 } } # info
23
+ it_behaves_like("a Syslog adapter") { subject { 2 } } # warn
24
+ it_behaves_like("a Syslog adapter") { subject { 3 } } # error
25
+ it_behaves_like("a Syslog adapter") { subject { 4 } } # fatal
26
+ it_behaves_like("a Syslog adapter") { subject { 5 } } # unknown
26
27
 
27
28
  context "a new Yell::Adapters::Syslog instance" do
28
29
  subject { Yell::Adapters::Syslog.new }
29
30
 
30
- it { subject.ident.should == $0 }
31
- it { subject.options.should == (Syslog::LOG_PID | Syslog::LOG_CONS) }
32
- it { subject.facility.should be_nil }
31
+ its(:ident) { should == $0 }
32
+ its(:options) { should == (Syslog::LOG_PID | Syslog::LOG_CONS) }
33
+ its(:facility) { should be_nil }
33
34
  end
34
35
 
35
36
  context "OptionMap" do
36
37
  subject { Yell::Adapters::Syslog::OptionMap }
37
38
 
38
- it { subject[:cons].should == Syslog::LOG_CONS }
39
- it { subject[:ndelay].should == Syslog::LOG_NDELAY }
40
- it { subject[:nowait].should == Syslog::LOG_NOWAIT }
41
- it { subject[:odelay].should == Syslog::LOG_ODELAY }
42
- it { subject[:perror].should == Syslog::LOG_PERROR }
43
- it { subject[:pid].should == Syslog::LOG_PID }
39
+ its([:cons]) { should == Syslog::LOG_CONS }
40
+ its([:ndelay]) { should == Syslog::LOG_NDELAY }
41
+ its([:nowait]) { should == Syslog::LOG_NOWAIT }
42
+ its([:odelay]) { should == Syslog::LOG_ODELAY }
43
+ its([:perror]) { should == Syslog::LOG_PERROR }
44
+ its([:pid]) { should == Syslog::LOG_PID }
44
45
  end
45
46
 
46
47
  context "FacilityMap" do
@@ -50,32 +51,32 @@ describe Yell::Adapters::Syslog do
50
51
  # :lrp => Syslog::LOG_LRP, # described in 1.9.3 docu, but not defined
51
52
  # :ntp => Syslog::LOG_NTP, # described in 1.9.3 docu, but not defined
52
53
  # :security => Syslog::LOG_SECURITY, # described in 1.9.3 docu, but not defined
53
- it { subject[:auth].should == Syslog::LOG_AUTH }
54
- it { subject[:authpriv].should == Syslog::LOG_AUTHPRIV }
55
- it { subject[:cron].should == Syslog::LOG_CRON }
56
- it { subject[:daemon].should == Syslog::LOG_DAEMON }
57
- it { subject[:ftp].should == Syslog::LOG_FTP }
58
- it { subject[:kern].should == Syslog::LOG_KERN }
59
- it { subject[:mail].should == Syslog::LOG_MAIL }
60
- it { subject[:news].should == Syslog::LOG_NEWS }
61
- it { subject[:syslog].should == Syslog::LOG_SYSLOG }
62
- it { subject[:user].should == Syslog::LOG_USER }
63
- it { subject[:uucp].should == Syslog::LOG_UUCP }
64
- it { subject[:local0].should == Syslog::LOG_LOCAL0 }
65
- it { subject[:local1].should == Syslog::LOG_LOCAL1 }
66
- it { subject[:local2].should == Syslog::LOG_LOCAL2 }
67
- it { subject[:local3].should == Syslog::LOG_LOCAL3 }
68
- it { subject[:local4].should == Syslog::LOG_LOCAL4 }
69
- it { subject[:local5].should == Syslog::LOG_LOCAL5 }
70
- it { subject[:local6].should == Syslog::LOG_LOCAL6 }
71
- it { subject[:local7].should == Syslog::LOG_LOCAL7 }
54
+ its([:auth]) { should == Syslog::LOG_AUTH }
55
+ its([:authpriv]) { should == Syslog::LOG_AUTHPRIV }
56
+ its([:cron]) { should == Syslog::LOG_CRON }
57
+ its([:daemon]) { should == Syslog::LOG_DAEMON }
58
+ its([:ftp]) { should == Syslog::LOG_FTP }
59
+ its([:kern]) { should == Syslog::LOG_KERN }
60
+ its([:mail]) { should == Syslog::LOG_MAIL }
61
+ its([:news]) { should == Syslog::LOG_NEWS }
62
+ its([:syslog]) { should == Syslog::LOG_SYSLOG }
63
+ its([:user]) { should == Syslog::LOG_USER }
64
+ its([:uucp]) { should == Syslog::LOG_UUCP }
65
+ its([:local0]) { should == Syslog::LOG_LOCAL0 }
66
+ its([:local1]) { should == Syslog::LOG_LOCAL1 }
67
+ its([:local2]) { should == Syslog::LOG_LOCAL2 }
68
+ its([:local3]) { should == Syslog::LOG_LOCAL3 }
69
+ its([:local4]) { should == Syslog::LOG_LOCAL4 }
70
+ its([:local5]) { should == Syslog::LOG_LOCAL5 }
71
+ its([:local6]) { should == Syslog::LOG_LOCAL6 }
72
+ its([:local7]) { should == Syslog::LOG_LOCAL7 }
72
73
  end
73
74
 
74
75
  context :ident do
75
76
  subject { Yell::Adapters::Syslog.new }
76
77
 
77
78
  it "should be passed" do
78
- mock.proxy( Syslog ).open( "my ident", anything, anything )
79
+ mock.proxy(Syslog).open("my ident", anything, anything)
79
80
 
80
81
  subject.ident = "my ident"
81
82
  subject.write event
@@ -86,14 +87,14 @@ describe Yell::Adapters::Syslog do
86
87
  subject { Yell::Adapters::Syslog.new }
87
88
 
88
89
  it "should be passed" do
89
- mock.proxy( Syslog ).open( anything, Syslog::LOG_NDELAY, anything )
90
+ mock.proxy(Syslog).open(anything, Syslog::LOG_NDELAY, anything)
90
91
 
91
92
  subject.options = :ndelay
92
93
  subject.write event
93
94
  end
94
95
 
95
96
  it "should work with multiple params" do
96
- mock.proxy( Syslog ).open( anything, Syslog::LOG_PID|Syslog::LOG_NDELAY, anything )
97
+ mock.proxy(Syslog).open(anything, Syslog::LOG_PID|Syslog::LOG_NDELAY, anything)
97
98
 
98
99
  subject.options = [:pid, :ndelay]
99
100
  subject.write event
@@ -104,19 +105,28 @@ describe Yell::Adapters::Syslog do
104
105
  subject { Yell::Adapters::Syslog.new }
105
106
 
106
107
  it "should be passed" do
107
- mock.proxy( Syslog ).open( anything, anything, Syslog::LOG_USER )
108
+ mock.proxy(Syslog).open(anything, anything, Syslog::LOG_USER)
108
109
 
109
110
  subject.facility = :user
110
111
  subject.write event
111
112
  end
112
113
 
113
114
  it "should work with multiple params" do
114
- mock.proxy( Syslog ).open( anything, anything, Syslog::LOG_DAEMON|Syslog::LOG_USER )
115
+ mock.proxy(Syslog).open(anything, anything, Syslog::LOG_DAEMON|Syslog::LOG_USER)
115
116
 
116
117
  subject.facility = [:daemon, :user]
117
118
  subject.write event
118
119
  end
119
120
  end
120
121
 
122
+ context :message do
123
+ subject { Yell::Adapters::Syslog.new }
124
+ let(:event) { Yell::Event.new(logger, 1, "Hello World".freeze) }
125
+
126
+ it "formats frozen strings" do
127
+ expect { subject.write event }.to_not raise_error
128
+ end
129
+ end
130
+
121
131
  end
122
132
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "yell-adapters-syslog"
5
- s.version = "1.2.0"
5
+ s.version = "2.0.0"
6
6
 
7
7
  s.authors = ["Rudolf Schmidt"]
8
8
 
@@ -18,5 +18,5 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_runtime_dependency "yell", "~> 1.2"
21
+ s.add_runtime_dependency "yell", "~> 2.0"
22
22
  end
metadata CHANGED
@@ -1,32 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yell-adapters-syslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Rudolf Schmidt
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
11
+ date: 2013-11-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: yell
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: '1.2'
19
+ version: '2.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: '1.2'
26
+ version: '2.0'
30
27
  description: Syslog adapter for Yell
31
28
  email:
32
29
  executables: []
@@ -46,28 +43,28 @@ files:
46
43
  - yell-adapters-syslog.gemspec
47
44
  homepage: http://rubygems.org/gems/yell
48
45
  licenses: []
46
+ metadata: {}
49
47
  post_install_message:
50
48
  rdoc_options: []
51
49
  require_paths:
52
50
  - lib
53
51
  required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
52
  requirements:
56
- - - ! '>='
53
+ - - '>='
57
54
  - !ruby/object:Gem::Version
58
55
  version: '0'
59
56
  required_rubygems_version: !ruby/object:Gem::Requirement
60
- none: false
61
57
  requirements:
62
- - - ! '>='
58
+ - - '>='
63
59
  - !ruby/object:Gem::Version
64
60
  version: '0'
65
61
  requirements: []
66
62
  rubyforge_project: yell
67
- rubygems_version: 1.8.24
63
+ rubygems_version: 2.0.6
68
64
  signing_key:
69
- specification_version: 3
65
+ specification_version: 4
70
66
  summary: Yell - Your Extensible Logging Library
71
67
  test_files:
72
68
  - spec/spec_helper.rb
73
69
  - spec/yell/adapters/syslog_spec.rb
70
+ has_rdoc: