yell 0.13.2 → 0.13.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yell.rb +3 -1
- data/lib/yell/adapters/base.rb +6 -4
- data/lib/yell/adapters/datefile.rb +19 -5
- data/lib/yell/event.rb +2 -6
- data/lib/yell/version.rb +1 -1
- data/spec/yell/adapters/datefile_spec.rb +2 -2
- data/yell.gemspec +6 -7
- metadata +2 -2
data/lib/yell.rb
CHANGED
data/lib/yell/adapters/base.rb
CHANGED
@@ -105,14 +105,16 @@ module Yell #:nodoc:
|
|
105
105
|
|
106
106
|
# Define instance method by given name and call the unbound
|
107
107
|
# methods in order with provided block.
|
108
|
-
def define!( name,
|
108
|
+
def define!( name, _m, m, &block )
|
109
109
|
if block.arity == 0
|
110
110
|
define_method( name ) do
|
111
|
-
|
111
|
+
_m.bind(self).call
|
112
|
+
m.bind(self).call
|
112
113
|
end
|
113
114
|
else
|
114
|
-
define_method( name ) do |*args|
|
115
|
-
|
115
|
+
define_method( name ) do |*args|
|
116
|
+
_m.bind(self).call(*args)
|
117
|
+
m.bind(self).call(*args)
|
116
118
|
end
|
117
119
|
end
|
118
120
|
end
|
@@ -19,9 +19,18 @@ module Yell #:nodoc:
|
|
19
19
|
@date = nil # default; do not override --R
|
20
20
|
|
21
21
|
self.date_pattern = options.fetch(:date_pattern, DefaultDatePattern)
|
22
|
-
self.symlink_original_filename = options.fetch(:symlink_original_filename, false)
|
23
22
|
self.keep = options.fetch(:keep, 0)
|
24
23
|
|
24
|
+
self.symlink = if options.key?(:symlink_original_filename)
|
25
|
+
Yell._deprecate( "0.13.3", "Use :symlink for symlinking to oriinal filename",
|
26
|
+
:before => "Yell.new { |l| l.adapter :datefile, :symlink_original_filename => true }",
|
27
|
+
:after => "Yell.new { |l| l.adapter :datefile, :symlink => true }"
|
28
|
+
)
|
29
|
+
options.fetch(:symlink_original_filename, false)
|
30
|
+
else
|
31
|
+
options.fetch(:symlink, false)
|
32
|
+
end
|
33
|
+
|
25
34
|
@original_filename = ::File.expand_path options.fetch(:filename, default_filename)
|
26
35
|
options[:filename] = @original_filename
|
27
36
|
end
|
@@ -33,7 +42,7 @@ module Yell #:nodoc:
|
|
33
42
|
return if ::File.exist?( @filename ) # do nothing when file ready present
|
34
43
|
|
35
44
|
cleanup! if cleanup?
|
36
|
-
|
45
|
+
symlink! if symlink?
|
37
46
|
|
38
47
|
stream.puts( Metadata.call(@date, date_pattern) )
|
39
48
|
end
|
@@ -55,8 +64,8 @@ module Yell #:nodoc:
|
|
55
64
|
# set to the newly created file, and so on.
|
56
65
|
#
|
57
66
|
# @example
|
58
|
-
#
|
59
|
-
attr_accessor :
|
67
|
+
# symlink = true
|
68
|
+
attr_accessor :symlink
|
60
69
|
|
61
70
|
# Set the amount of logfiles to keep when rolling over.
|
62
71
|
# By default, no files will be cleaned up.
|
@@ -104,11 +113,16 @@ module Yell #:nodoc:
|
|
104
113
|
keep.to_i > 0
|
105
114
|
end
|
106
115
|
|
107
|
-
def
|
116
|
+
def symlink!
|
108
117
|
::File.unlink( @original_filename ) if ::File.symlink?( @original_filename )
|
118
|
+
|
109
119
|
::File.symlink( @filename, @original_filename )
|
110
120
|
end
|
111
121
|
|
122
|
+
def symlink?
|
123
|
+
!!symlink
|
124
|
+
end
|
125
|
+
|
112
126
|
# Sets the filename with the `:date_pattern` appended to it.
|
113
127
|
def filename_from( date )
|
114
128
|
@original_filename.sub( /(\.\w+)?$/, ".#{date.strftime(date_pattern)}\\1" )
|
data/lib/yell/event.rb
CHANGED
@@ -12,12 +12,8 @@ module Yell #:nodoc:
|
|
12
12
|
# regex to fetch caller attributes
|
13
13
|
CallerRegexp = /^(.+?):(\d+)(?::in `(.+)')?/
|
14
14
|
|
15
|
-
# jruby and rubinius
|
16
|
-
|
17
|
-
CallerIndex =1
|
18
|
-
else
|
19
|
-
CallerIndex = 2
|
20
|
-
end
|
15
|
+
# jruby and rubinius seem to have a different caller
|
16
|
+
CallerIndex = defined?(RUBY_ENGINE) && ["rbx", "jruby"].include?(RUBY_ENGINE) ? 1 : 2
|
21
17
|
|
22
18
|
# Prefetch those values (no need to do that on every new instance)
|
23
19
|
@@hostname = Socket.gethostname rescue nil
|
data/lib/yell/version.rb
CHANGED
@@ -59,8 +59,8 @@ describe Yell::Adapters::Datefile do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
describe :
|
63
|
-
let( :adapter ) { Yell::Adapters::Datefile.new(:
|
62
|
+
describe :symlink do
|
63
|
+
let( :adapter ) { Yell::Adapters::Datefile.new(:symlink => true, :filename => filename, :date_pattern => "%M") }
|
64
64
|
let( :time ) { Time.now }
|
65
65
|
|
66
66
|
it "should symlink to the orignal given :filename" do
|
data/yell.gemspec
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require "yell/version"
|
2
|
+
require File.expand_path( '../lib/yell/version', __FILE__ )
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = "yell"
|
7
6
|
s.version = Yell::VERSION
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
7
|
s.authors = ["Rudolf Schmidt"]
|
10
8
|
|
11
9
|
s.homepage = "http://rudionrails.github.com/yell"
|
12
|
-
s.summary = %q{Yell - Your Extensible Logging Library
|
10
|
+
s.summary = %q{Yell - Your Extensible Logging Library}
|
13
11
|
s.description = %q{Yell - Your Extensible Logging Library. Define multiple adapters, various log level combinations or message formatting options like you've never done before}
|
14
12
|
|
15
13
|
s.rubyforge_project = "yell"
|
16
14
|
|
17
|
-
s.files = `git ls-files`.split(
|
18
|
-
s.
|
19
|
-
s.
|
15
|
+
s.files = `git ls-files`.split($\)
|
16
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
+
|
20
19
|
s.require_paths = ["lib"]
|
21
20
|
end
|
22
21
|
|
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: 0.13.
|
4
|
+
version: 0.13.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: 2012-09-
|
12
|
+
date: 2012-09-13 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
|