prefixed-log-formatter 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.
data/.gitignore ADDED
@@ -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 prefixed-log-formatter.gemspec
4
+ gemspec
data/README.markdown ADDED
@@ -0,0 +1 @@
1
+ Log file lines should be prefixed with log level, timestamp, process id and an easy-to-grep "end of prefix" marker. This subclass of Logger::Formatter does those things.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ require 'prefixed-log-formatter/version'
2
+ require 'logger'
3
+
4
+ module PrefixedLogFormatter
5
+ class Formatter < ::Logger::Formatter
6
+ attr_accessor :prefix_separator
7
+
8
+ def initialize
9
+ super
10
+ @prefix_separator = ':::'
11
+ end
12
+
13
+ def call(severity, timestamp, progname, msg)
14
+ prefix = "#{severity[0..0]} #{format_datetime(timestamp)} #{$$} #{prefix_separator} "
15
+ msg2str(msg).gsub(/^/, prefix) << "\n"
16
+ end
17
+
18
+ private
19
+
20
+ def format_datetime(time)
21
+ time.strftime("%Y-%m-%d %H:%M:%S")
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module PrefixedLogFormatter
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "prefixed-log-formatter/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "prefixed-log-formatter"
7
+ s.version = PrefixedLogFormatter::VERSION
8
+ s.authors = ["Jordan Brough"]
9
+ s.email = ["jordan@animoto.com"]
10
+ s.homepage = "http://github.com/jordan-brough/prefixed-logger-formatter"
11
+ s.summary = "Sensible and minimal log prefixng for Ruby apps"
12
+ s.description = %q{Log file lines should be prefixed with log level, timestamp, process id and an easy-to-grep "end of prefix" marker. This subclass of Logger::Formatter does those things.}
13
+
14
+ s.rubyforge_project = "prefixed-log-formatter"
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: prefixed-log-formatter
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-05 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: Log file lines should be prefixed with log level, timestamp, process id and an easy-to-grep "end of prefix" marker. This subclass of Logger::Formatter does those things.
22
+ email:
23
+ - jordan@animoto.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - README.markdown
34
+ - Rakefile
35
+ - lib/prefixed-log-formatter.rb
36
+ - lib/prefixed-log-formatter/version.rb
37
+ - prefixed-log-formatter.gemspec
38
+ homepage: http://github.com/jordan-brough/prefixed-logger-formatter
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: prefixed-log-formatter
67
+ rubygems_version: 1.8.15
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Sensible and minimal log prefixng for Ruby apps
71
+ test_files: []
72
+