logging 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,10 @@
1
+ == 1.5.1 / 2011-06-03
2
+
3
+ Bug Fixes
4
+ - IO streams cannot be buffered when using syswrite
5
+ - JRuby does not allow shared locks on write only file descriptors
6
+ - Fixing tests for JRuby 1.6.X
7
+
1
8
  == 1.5.0 / 2011-03-22
2
9
 
3
10
  Minor Enhancements
@@ -1,8 +1,8 @@
1
1
  Logging
2
2
  by Tim Pease
3
3
 
4
- * {Homepage}[http://logging.rubyforge.org/]
5
- * {Rubyforge Project}[http://rubyforge.org/projects/logging]
4
+ * {Homepage}[http://rubygems.org/gems/logging]
5
+ * {Github Project}[http://github.com/TwP/logging]
6
6
  * email tim dot pease at gmail dot com
7
7
 
8
8
  == DESCRIPTION
@@ -14,7 +14,7 @@ formatting, and more.
14
14
 
15
15
  == INSTALL
16
16
 
17
- sudo gem install logging
17
+ gem install logging
18
18
 
19
19
  == EXAMPLE
20
20
 
@@ -57,36 +57,38 @@ the recommended way of accomplishing this.
57
57
 
58
58
  class FirstClass
59
59
  def initialize
60
- @log = Logging.logger[self]
60
+ @logger = Logging.logger[self]
61
61
  end
62
62
 
63
63
  def some_method
64
- @log.debug "some method was called on #{self.inspect}"
64
+ @logger.debug "some method was called on #{self.inspect}"
65
65
  end
66
66
  end
67
67
 
68
68
  class SecondClass
69
69
  def initialize
70
- @log = Logging.logger[self]
70
+ @logger = Logging.logger[self]
71
71
  end
72
72
 
73
73
  def another_method
74
- @log.debug "another method was called on #{self.inspect}"
74
+ @logger.debug "another method was called on #{self.inspect}"
75
75
  end
76
76
  end
77
77
 
78
78
  There are many more examples in the "examples" folder of the logging
79
79
  package. The recommended reading order is the following:
80
80
 
81
- simple.rb
82
- loggers.rb
83
- classes.rb
84
- hierarchies.rb
85
- names.rb
86
- appenders.rb
87
- layouts.rb
88
- formatting.rb
89
- consolidation.rb
81
+ * {simple.rb}[http://github.com/TwP/logging/blob/master/examples/simple.rb]
82
+ * {loggers.rb}[http://github.com/TwP/logging/blob/master/examples/loggers.rb]
83
+ * {classes.rb}[http://github.com/TwP/logging/blob/master/examples/classes.rb]
84
+ * {hierarchies.rb}[http://github.com/TwP/logging/blob/master/examples/hierarchies.rb]
85
+ * {names.rb}[http://github.com/TwP/logging/blob/master/examples/names.rb]
86
+ * {appenders.rb}[http://github.com/TwP/logging/blob/master/examples/appenders.rb]
87
+ * {layouts.rb}[http://github.com/TwP/logging/blob/master/examples/layouts.rb]
88
+ * {formatting.rb}[http://github.com/TwP/logging/blob/master/examples/formatting.rb]
89
+ * {colorization.rb}[http://github.com/TwP/logging/blob/master/examples/colorization.rb]
90
+ * {consolidation.rb}[http://github.com/TwP/logging/blob/master/examples/consolidation.rb]
91
+ * {fork.rb}[http://github.com/TwP/logging/blob/master/examples/fork.rb]
90
92
 
91
93
  == NOTES
92
94
 
@@ -99,17 +101,19 @@ class names.
99
101
 
100
102
  == REQUIREMENTS
101
103
 
102
- Logging requires the "lockfile" gem to run and the "flexmock" gem to run the
103
- tests"
104
-
105
- == DEVELOPMENT REQUIREMENTS
106
-
107
104
  The Logging source code relies on the Mr Bones project for default rake tasks.
108
105
  You will need to install the Mr Bones gem if you want to build or test the
109
106
  logging gem.
110
107
 
111
108
  gem install bones
112
109
 
110
+ After Mr Bones is installed you can install all the depdencies via the rake
111
+ task.
112
+
113
+ rake gem:install_dependencies
114
+
115
+ Always remember that "rake -T" is your friend!
116
+
113
117
  == LICENSE
114
118
 
115
119
  Ruby
@@ -20,6 +20,8 @@ module Logging::Appenders
20
20
  end
21
21
 
22
22
  @io = io
23
+ @io.sync = true if io.respond_to? :sync= # syswrite complains if the IO stream is buffered
24
+
23
25
  configure_buffering(opts)
24
26
  super(name, opts)
25
27
  end
@@ -131,7 +131,9 @@ module Logging::Appenders
131
131
  meta = class << self; self end
132
132
  meta.class_eval code, __FILE__, __LINE__
133
133
 
134
- super(name, ::File.new(@fn, 'a'), opts)
134
+ # we are opening the file in read/write mode so that a shared lock can
135
+ # be used on the file descriptor => http://pubs.opengroup.org/onlinepubs/009695399/functions/fcntl.html
136
+ super(name, ::File.new(@fn, 'a+'), opts)
135
137
 
136
138
  # setup the file roller
137
139
  @roller =
@@ -167,7 +169,7 @@ module Logging::Appenders
167
169
  @io.close rescue nil
168
170
  end
169
171
  @closed = false
170
- @io = ::File.new(@fn, 'a')
172
+ @io = ::File.new(@fn, 'a+')
171
173
  }
172
174
  self
173
175
  end
@@ -12,8 +12,8 @@ module Logging
12
12
  # * $2 == line number
13
13
  # * $3 == method name (might be nil)
14
14
  CALLER_RGXP = %r/([-\.\/\(\)\w]+):(\d+)(?::in `(\w+)')?/o
15
- CALLER_INDEX = 2
16
- #CALLER_INDEX = RUBY_PLATFORM[%r/^java/i] ? 1 : 2
15
+ #CALLER_INDEX = 2
16
+ CALLER_INDEX = (defined? JRUBY_VERSION and JRUBY_VERSION[%r/^1.6/]) ? 1 : 2
17
17
  # :startdoc:
18
18
 
19
19
  # call-seq:
@@ -42,4 +42,3 @@ module Logging
42
42
  }
43
43
  end # module Logging
44
44
 
45
- # EOF
@@ -141,11 +141,11 @@ class File
141
141
  # return immediately (and the block will not be executed) if an exclusive
142
142
  # lock cannot be obtained.
143
143
  #
144
- def flock?( &block )
144
+ def flock?
145
145
  status = flock(LOCK_EX|LOCK_NB)
146
146
  case status
147
147
  when false; true
148
- when 0; block ? block.call : false
148
+ when 0; block_given? ? yield : false
149
149
  else
150
150
  raise SystemCallError, "flock failed with status: #{status}"
151
151
  end
@@ -153,13 +153,13 @@ class File
153
153
  flock LOCK_UN
154
154
  end
155
155
 
156
- # Execute the <tt>block</tt> in the context of a shared lock on this file. A
156
+ # Execute a <tt>block</tt> in the context of a shared lock on this file. A
157
157
  # shared lock will be obtained on the file, the block executed, and the lock
158
158
  # released.
159
159
  #
160
- def flock_sh( &block )
160
+ def flock_sh
161
161
  flock LOCK_SH
162
- block.call
162
+ yield
163
163
  ensure
164
164
  flock LOCK_UN
165
165
  end
@@ -20,7 +20,7 @@ module TestAppenders
20
20
  end
21
21
 
22
22
  def test_append
23
- return if RUBY_PLATFORM =~ %r/cygwin/
23
+ return if RUBY_PLATFORM =~ %r/cygwin|java/i
24
24
 
25
25
  stderr = IO::pipe
26
26
 
@@ -78,7 +78,7 @@ module TestAppenders
78
78
  end
79
79
 
80
80
  def test_concat
81
- return if RUBY_PLATFORM =~ %r/cygwin/
81
+ return if RUBY_PLATFORM =~ %r/cygwin|java/i
82
82
 
83
83
  stderr = IO::pipe
84
84
 
@@ -1 +1 @@
1
- 1.5.0
1
+ 1.5.1
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logging
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 0
10
- version: 1.5.0
9
+ - 1
10
+ version: 1.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Pease
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-22 00:00:00 -06:00
18
+ date: 2011-06-03 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -90,12 +90,12 @@ dependencies:
90
90
  requirements:
91
91
  - - ">="
92
92
  - !ruby/object:Gem::Version
93
- hash: 21
93
+ hash: 27
94
94
  segments:
95
95
  - 3
96
- - 6
97
- - 5
98
- version: 3.6.5
96
+ - 7
97
+ - 0
98
+ version: 3.7.0
99
99
  type: :development
100
100
  version_requirements: *id005
101
101
  description: |-