rails-cron-logger 1.0.0

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.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in rails-cron-logger.gemspec
4
+ gemspec
@@ -0,0 +1,25 @@
1
+ ## RailsCronLogger
2
+
3
+ ### A logger for rails cron jobs that want output that is:
4
+
5
+ 1. Formatted in the same way as Rails.logger
6
+ 2. At the same log level as Rails.logger
7
+ 3. Sent to stdout, except in test mode
8
+
9
+ ### Example usage
10
+
11
+ logger = RailsCronLogger::Logger.new
12
+ logger.info "info"
13
+ logger.debug "debug"
14
+
15
+ ### Note on flushing
16
+
17
+ You probably also want to set `$stdout.sync = true` in your crontab.
18
+
19
+ See http://coderrr.wordpress.com/2008/12/20/automatically-flushing-redirected-or-piped-stdout/
20
+
21
+ Example:
22
+
23
+ 1 * * * * rails runner '$stdout.sync = true; <your code here>'
24
+
25
+ Setting `$stdout.sync = true` in this gem seems like it would be a bit overreaching.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,20 @@
1
+ require 'logger'
2
+ require 'rails-cron-logger/version'
3
+
4
+ module RailsCronLogger
5
+ class Logger < Logger
6
+ def initialize
7
+ logdev = if Rails.env.test?
8
+ # don't want log messages for tests mixed in with test output
9
+ Rails.application.config.paths.log.first
10
+ else
11
+ $stdout
12
+ end
13
+
14
+ super(logdev)
15
+
16
+ @formatter = Rails.logger.formatter
17
+ @level = Rails.logger.level
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ module Rails
2
+ module Cron
3
+ module Logger
4
+ VERSION = "1.0.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rails-cron-logger/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rails-cron-logger"
7
+ s.version = Rails::Cron::Logger::VERSION
8
+ s.authors = ["Jordan Brough"]
9
+ s.email = ["jordan@broughs.net"]
10
+ s.homepage = "https://github.com/jordan-brough/rails-cron-logger"
11
+ s.summary = "A logger for rails cron jobs"
12
+ s.description = "See readme."
13
+
14
+ s.rubyforge_project = "rails-cron-logger"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails-cron-logger
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Jordan Brough
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-03-08 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: See readme.
22
+ email:
23
+ - jordan@broughs.net
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - README.md
34
+ - Rakefile
35
+ - lib/rails-cron-logger.rb
36
+ - lib/rails-cron-logger/version.rb
37
+ - rails-cron-logger.gemspec
38
+ homepage: https://github.com/jordan-brough/rails-cron-logger
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ hash: 3
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ requirements: []
65
+
66
+ rubyforge_project: rails-cron-logger
67
+ rubygems_version: 1.8.15
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: A logger for rails cron jobs
71
+ test_files: []
72
+