rails-cron-logger 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -2
- data/lib/rails-cron-logger.rb +3 -1
- data/lib/rails-cron-logger/version.rb +1 -1
- metadata +6 -5
data/README.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
## RailsCronLogger
|
2
2
|
|
3
|
-
### A logger for rails cron jobs that want output that is:
|
3
|
+
### A logger for rails cron jobs that want output that is sent to standard out and is:
|
4
4
|
|
5
5
|
1. Formatted in the same way as Rails.logger
|
6
6
|
2. At the same log level as Rails.logger
|
7
|
-
3. Sent to stdout, except in test mode
|
8
7
|
|
9
8
|
### Example usage
|
10
9
|
|
@@ -12,6 +11,14 @@
|
|
12
11
|
logger.info "info"
|
13
12
|
logger.debug "debug"
|
14
13
|
|
14
|
+
You can optionally supply a :logdev parameter to send the logs somewhere else, while keeping the formatting and log level of Rails.
|
15
|
+
|
16
|
+
logger = RailsCronLogger::Logger.new(:logdev => '/some/log/path.log')
|
17
|
+
|
18
|
+
:logdev is the same type of argument as can be passed to the [normal Ruby Logger](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html#method-c-new)
|
19
|
+
|
20
|
+
Note: In the test environment logs are sent to the normal Rails log device by default to avoid mixing log messages with test output.
|
21
|
+
|
15
22
|
### Note on flushing
|
16
23
|
|
17
24
|
You probably also want to set `$stdout.sync = true` in your crontab.
|
data/lib/rails-cron-logger.rb
CHANGED
@@ -13,7 +13,9 @@ module RailsCronLogger
|
|
13
13
|
$stdout.sync = true
|
14
14
|
end
|
15
15
|
|
16
|
-
logdev = if
|
16
|
+
logdev = if options[:logdev].present?
|
17
|
+
options[:logdev]
|
18
|
+
elsif Rails.env.test?
|
17
19
|
# don't want log messages for tests mixed in with test output
|
18
20
|
Rails.application.config.paths.log.first
|
19
21
|
else
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-cron-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordan Brough
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-03-13 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: See readme.
|
@@ -64,9 +64,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements: []
|
65
65
|
|
66
66
|
rubyforge_project: rails-cron-logger
|
67
|
-
rubygems_version: 1.8.
|
67
|
+
rubygems_version: 1.8.24
|
68
68
|
signing_key:
|
69
69
|
specification_version: 3
|
70
70
|
summary: A logger for rails cron jobs
|
71
71
|
test_files: []
|
72
72
|
|
73
|
+
has_rdoc:
|