releaseable 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/releaseable/extensions.rb +19 -1
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.20
1
+ 0.0.21
@@ -60,6 +60,7 @@ class Logger
60
60
  @handler.logdev.dev.deliverer.kill
61
61
  end
62
62
  end
63
+ @file_logger.close if @file_logger
63
64
  close
64
65
  end
65
66
 
@@ -113,8 +114,8 @@ class Logger
113
114
 
114
115
  @handle_fatal_errors = @config[:ignore] ? false : true
115
116
 
117
+ # Configure fatal error handler:
116
118
  if @handle_fatal_errors
117
-
118
119
  @config[:tag] = config[:tag] || config[:name] || !config[:connection] ? "Tag#{rand(10000)}" :
119
120
  "#{config[:env]}-#{config[:connection][:client_id]}-#{config[:connection][:account]}"
120
121
  @config[:domain] ||= 'https://logs.loggly.com'
@@ -133,6 +134,23 @@ class Logger
133
134
  self.formatter = formatter || proc do |level, time, prog, msg|
134
135
  "#{time.strftime(@config[:time_format])} #{msg}\n"
135
136
  end
137
+
138
+ # Configure detailed backup file logger:
139
+ if @config[:file]
140
+ @file = Pathname.new(@config[:file]).realpath.to_s
141
+ @file_logger = Logger.new(@file).tap do |logger|
142
+ logger.formatter = proc do |level, time, prog, msg|
143
+ "#{time.strftime('%H:%M:%S.%N')} #{level[0..0]} #{msg}\n"
144
+ end
145
+ logger.level = Logger::INFO #DEBUG
146
+ end
147
+ end
136
148
  end
137
149
 
150
+ alias old_add add
151
+
152
+ def add *args
153
+ @file_logger.add *args if @file_logger
154
+ old_add *args
155
+ end
138
156
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: releaseable
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.20
5
+ version: 0.0.21
6
6
  platform: ruby
7
7
  authors:
8
8
  - arvicco
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-02-22 00:00:00 Z
13
+ date: 2012-03-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler