yell 1.2.2 → 1.2.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.
- data/lib/yell/event.rb +4 -6
- data/lib/yell/version.rb +1 -1
- data/spec/yell/event_spec.rb +22 -0
- metadata +2 -2
data/lib/yell/event.rb
CHANGED
@@ -17,9 +17,11 @@ module Yell #:nodoc:
|
|
17
17
|
|
18
18
|
# Prefetch those values (no need to do that on every new instance)
|
19
19
|
@@hostname = Socket.gethostname rescue nil
|
20
|
-
@@pid = Process.pid
|
21
20
|
@@progname = $0
|
22
21
|
|
22
|
+
# Accessor to the pid
|
23
|
+
attr_reader :pid
|
24
|
+
|
23
25
|
# Accessor to the log level
|
24
26
|
attr_reader :level
|
25
27
|
|
@@ -34,6 +36,7 @@ module Yell #:nodoc:
|
|
34
36
|
|
35
37
|
|
36
38
|
def initialize( level, *messages, &block )
|
39
|
+
@pid = Process.pid
|
37
40
|
@time = Time.now
|
38
41
|
@level = level
|
39
42
|
|
@@ -53,11 +56,6 @@ module Yell #:nodoc:
|
|
53
56
|
@@hostname
|
54
57
|
end
|
55
58
|
|
56
|
-
# Accessor to the pid
|
57
|
-
def pid
|
58
|
-
@@pid
|
59
|
-
end
|
60
|
-
|
61
59
|
# Accessor to the progname
|
62
60
|
def progname
|
63
61
|
@@progname
|
data/lib/yell/version.rb
CHANGED
data/spec/yell/event_spec.rb
CHANGED
@@ -70,8 +70,30 @@ describe Yell::Event do
|
|
70
70
|
it { should == Process.pid }
|
71
71
|
end
|
72
72
|
|
73
|
+
context "pid when forked", :pending => RUBY_PLATFORM == 'java' do # no forking with jruby
|
74
|
+
subject { @pid }
|
75
|
+
|
76
|
+
before do
|
77
|
+
read, write = IO.pipe
|
78
|
+
|
79
|
+
@pid = Process.fork do
|
80
|
+
event = Yell::Event.new 1, 'Hello World!'
|
81
|
+
write.puts event.pid
|
82
|
+
end
|
83
|
+
Process.wait
|
84
|
+
write.close
|
85
|
+
|
86
|
+
@child_pid = read.read.to_i
|
87
|
+
read.close
|
88
|
+
end
|
89
|
+
|
90
|
+
it { should_not == Process.pid }
|
91
|
+
it { should == @child_pid }
|
92
|
+
end
|
93
|
+
|
73
94
|
context :progname do
|
74
95
|
subject { event.progname }
|
75
96
|
it { should == $0 }
|
76
97
|
end
|
98
|
+
|
77
99
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-16 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Yell - Your Extensible Logging Library. Define multiple adapters, various
|
15
15
|
log level combinations or message formatting options like you've never done before
|