lumberjack_aziz_light 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT_LICENSE +20 -0
- data/README.rdoc +100 -0
- data/Rakefile +40 -0
- data/VERSION +1 -0
- data/lib/lumberjack/device/date_rolling_log_file.rb +58 -0
- data/lib/lumberjack/device/log_file.rb +18 -0
- data/lib/lumberjack/device/null.rb +15 -0
- data/lib/lumberjack/device/rolling_log_file.rb +110 -0
- data/lib/lumberjack/device/size_rolling_log_file.rb +60 -0
- data/lib/lumberjack/device/writer.rb +129 -0
- data/lib/lumberjack/device.rb +26 -0
- data/lib/lumberjack/formatter/exception_formatter.rb +12 -0
- data/lib/lumberjack/formatter/inspect_formatter.rb +10 -0
- data/lib/lumberjack/formatter/pretty_print_formatter.rb +23 -0
- data/lib/lumberjack/formatter/string_formatter.rb +10 -0
- data/lib/lumberjack/formatter.rb +76 -0
- data/lib/lumberjack/log_entry.rb +36 -0
- data/lib/lumberjack/logger.rb +302 -0
- data/lib/lumberjack/rack/unit_of_work.rb +15 -0
- data/lib/lumberjack/rack.rb +5 -0
- data/lib/lumberjack/severity.rb +23 -0
- data/lib/lumberjack/template.rb +71 -0
- data/lib/lumberjack.rb +42 -0
- data/spec/device/date_rolling_log_file_spec.rb +66 -0
- data/spec/device/log_file_spec.rb +26 -0
- data/spec/device/null_spec.rb +12 -0
- data/spec/device/rolling_log_file_spec.rb +129 -0
- data/spec/device/size_rolling_log_file_spec.rb +54 -0
- data/spec/device/writer_spec.rb +118 -0
- data/spec/formatter/exception_formatter_spec.rb +20 -0
- data/spec/formatter/inspect_formatter_spec.rb +13 -0
- data/spec/formatter/pretty_print_formatter_spec.rb +14 -0
- data/spec/formatter/string_formatter_spec.rb +12 -0
- data/spec/formatter_spec.rb +45 -0
- data/spec/log_entry_spec.rb +69 -0
- data/spec/logger_spec.rb +390 -0
- data/spec/lumberjack_spec.rb +29 -0
- data/spec/rack/unit_of_work_spec.rb +26 -0
- data/spec/severity_spec.rb +23 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/template_spec.rb +34 -0
- metadata +92 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lumberjack do
|
4
|
+
|
5
|
+
context "unit of work" do
|
6
|
+
it "should create a unit work with a unique id in a block" do
|
7
|
+
Lumberjack.unit_of_work_id.should == nil
|
8
|
+
Lumberjack.unit_of_work do
|
9
|
+
id_1 = Lumberjack.unit_of_work_id
|
10
|
+
id_1.should match(/^[0-9A-F]{12}$/)
|
11
|
+
Lumberjack.unit_of_work do
|
12
|
+
id_2 = Lumberjack.unit_of_work_id
|
13
|
+
id_2.should match(/^[0-9A-F]{12}$/)
|
14
|
+
id_2.should_not == id_1
|
15
|
+
end
|
16
|
+
id_1.should == Lumberjack.unit_of_work_id
|
17
|
+
end
|
18
|
+
Lumberjack.unit_of_work_id.should == nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should allow you to specify a unit of work id for a block" do
|
22
|
+
Lumberjack.unit_of_work("foo") do
|
23
|
+
Lumberjack.unit_of_work_id.should == "foo"
|
24
|
+
end
|
25
|
+
Lumberjack.unit_of_work_id.should == nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lumberjack::Rack::UnitOfWork do
|
4
|
+
|
5
|
+
it "should create a unit of work in a middleware stack" do
|
6
|
+
app = lambda{|env| [200, {"Content-Type" => env["Content-Type"], "Unit-Of-Work" => Lumberjack.unit_of_work_id.to_s}, ["OK"]]}
|
7
|
+
handler = Lumberjack::Rack::UnitOfWork.new(app)
|
8
|
+
|
9
|
+
response = handler.call("Content-Type" => "text/plain")
|
10
|
+
response[0].should == 200
|
11
|
+
response[1]["Content-Type"].should == "text/plain"
|
12
|
+
unit_of_work_1 = response[1]["Unit-Of-Work"]
|
13
|
+
response[2].should == ["OK"]
|
14
|
+
|
15
|
+
response = handler.call("Content-Type" => "text/html")
|
16
|
+
response[0].should == 200
|
17
|
+
response[1]["Content-Type"].should == "text/html"
|
18
|
+
unit_of_work_2 = response[1]["Unit-Of-Work"]
|
19
|
+
response[2].should == ["OK"]
|
20
|
+
|
21
|
+
unit_of_work_1.should_not == nil
|
22
|
+
unit_of_work_2.should_not == nil
|
23
|
+
unit_of_work_1.should_not == unit_of_work_2
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lumberjack::Severity do
|
4
|
+
|
5
|
+
it "should convert a level to a label" do
|
6
|
+
Lumberjack::Severity.level_to_label(Lumberjack::Severity::DEBUG).should == "DEBUG"
|
7
|
+
Lumberjack::Severity.level_to_label(Lumberjack::Severity::INFO).should == "INFO"
|
8
|
+
Lumberjack::Severity.level_to_label(Lumberjack::Severity::WARN).should == "WARN"
|
9
|
+
Lumberjack::Severity.level_to_label(Lumberjack::Severity::ERROR).should == "ERROR"
|
10
|
+
Lumberjack::Severity.level_to_label(Lumberjack::Severity::FATAL).should == "FATAL"
|
11
|
+
Lumberjack::Severity.level_to_label(-1).should == "UNKNOWN"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should convert a label to a level" do
|
15
|
+
Lumberjack::Severity.label_to_level("DEBUG").should == Lumberjack::Severity::DEBUG
|
16
|
+
Lumberjack::Severity.label_to_level(:info).should == Lumberjack::Severity::INFO
|
17
|
+
Lumberjack::Severity.label_to_level(:warn).should == Lumberjack::Severity::WARN
|
18
|
+
Lumberjack::Severity.label_to_level("Error").should == Lumberjack::Severity::ERROR
|
19
|
+
Lumberjack::Severity.label_to_level("FATAL").should == Lumberjack::Severity::FATAL
|
20
|
+
Lumberjack::Severity.label_to_level("???").should == Lumberjack::Severity::UNKNOWN
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path("../../lib/lumberjack.rb", __FILE__)
|
2
|
+
require 'stringio'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
def tmp_dir
|
6
|
+
File.expand_path("../tmp", __FILE__)
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_tmp_dir
|
10
|
+
FileUtils.rm_r(tmp_dir) if File.exist?(tmp_dir)
|
11
|
+
FileUtils.mkdir_p(tmp_dir)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete_tmp_dir
|
15
|
+
FileUtils.rm_r(tmp_dir)
|
16
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lumberjack::Template do
|
4
|
+
|
5
|
+
let(:time_string){ "2011-01-15T14:23:45.123" }
|
6
|
+
let(:time){ Time.parse(time_string) }
|
7
|
+
let(:entry){ Lumberjack::LogEntry.new(time, Lumberjack::Severity::INFO, "line 1#{Lumberjack::LINE_SEPARATOR}line 2#{Lumberjack::LINE_SEPARATOR}line 3", "app", 12345, "ABCD") }
|
8
|
+
|
9
|
+
it "should format a log entry with a template string" do
|
10
|
+
template = Lumberjack::Template.new(":message - :severity, :time, :progname@:pid (:unit_of_work_id)")
|
11
|
+
template.call(entry).should == "line 1 - INFO, 2011-01-15T14:23:45.123, app@12345 (ABCD)#{Lumberjack::LINE_SEPARATOR}line 2#{Lumberjack::LINE_SEPARATOR}line 3"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should be able to specify the time format for log entries as microseconds" do
|
15
|
+
template = Lumberjack::Template.new(":message (:time)", :time_format => :microseconds)
|
16
|
+
template.call(entry).should == "line 1 (2011-01-15T14:23:45.123000)#{Lumberjack::LINE_SEPARATOR}line 2#{Lumberjack::LINE_SEPARATOR}line 3"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to specify the time format for log entries as milliseconds" do
|
20
|
+
template = Lumberjack::Template.new(":message (:time)", :time_format => :milliseconds)
|
21
|
+
template.call(entry).should == "line 1 (2011-01-15T14:23:45.123)#{Lumberjack::LINE_SEPARATOR}line 2#{Lumberjack::LINE_SEPARATOR}line 3"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be able to specify the time format for log entries with a custom format" do
|
25
|
+
template = Lumberjack::Template.new(":message (:time)", :time_format => "%m/%d/%Y, %I:%M:%S %p")
|
26
|
+
template.call(entry).should == "line 1 (01/15/2011, 02:23:45 PM)#{Lumberjack::LINE_SEPARATOR}line 2#{Lumberjack::LINE_SEPARATOR}line 3"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should be able to specify a template for additional lines in a message" do
|
30
|
+
template = Lumberjack::Template.new(":message (:time)", :additional_lines => " // :message")
|
31
|
+
template.call(entry).should == "line 1 (2011-01-15T14:23:45.123) // line 2 // line 3"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lumberjack_aziz_light
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Durand
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple, powerful, and very fast logging utility that can be a drop
|
14
|
+
in replacement for Logger or ActiveSupport::BufferedLogger. Provides support for
|
15
|
+
automatically rolling log files even with multiple processes writing the same log
|
16
|
+
file.
|
17
|
+
email:
|
18
|
+
- bdurand@embellishedvisions.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files:
|
22
|
+
- README.rdoc
|
23
|
+
files:
|
24
|
+
- README.rdoc
|
25
|
+
- VERSION
|
26
|
+
- Rakefile
|
27
|
+
- MIT_LICENSE
|
28
|
+
- lib/lumberjack/device/date_rolling_log_file.rb
|
29
|
+
- lib/lumberjack/device/log_file.rb
|
30
|
+
- lib/lumberjack/device/null.rb
|
31
|
+
- lib/lumberjack/device/rolling_log_file.rb
|
32
|
+
- lib/lumberjack/device/size_rolling_log_file.rb
|
33
|
+
- lib/lumberjack/device/writer.rb
|
34
|
+
- lib/lumberjack/device.rb
|
35
|
+
- lib/lumberjack/formatter/exception_formatter.rb
|
36
|
+
- lib/lumberjack/formatter/inspect_formatter.rb
|
37
|
+
- lib/lumberjack/formatter/pretty_print_formatter.rb
|
38
|
+
- lib/lumberjack/formatter/string_formatter.rb
|
39
|
+
- lib/lumberjack/formatter.rb
|
40
|
+
- lib/lumberjack/log_entry.rb
|
41
|
+
- lib/lumberjack/logger.rb
|
42
|
+
- lib/lumberjack/rack/unit_of_work.rb
|
43
|
+
- lib/lumberjack/rack.rb
|
44
|
+
- lib/lumberjack/severity.rb
|
45
|
+
- lib/lumberjack/template.rb
|
46
|
+
- lib/lumberjack.rb
|
47
|
+
- spec/device/date_rolling_log_file_spec.rb
|
48
|
+
- spec/device/log_file_spec.rb
|
49
|
+
- spec/device/null_spec.rb
|
50
|
+
- spec/device/rolling_log_file_spec.rb
|
51
|
+
- spec/device/size_rolling_log_file_spec.rb
|
52
|
+
- spec/device/writer_spec.rb
|
53
|
+
- spec/formatter/exception_formatter_spec.rb
|
54
|
+
- spec/formatter/inspect_formatter_spec.rb
|
55
|
+
- spec/formatter/pretty_print_formatter_spec.rb
|
56
|
+
- spec/formatter/string_formatter_spec.rb
|
57
|
+
- spec/formatter_spec.rb
|
58
|
+
- spec/log_entry_spec.rb
|
59
|
+
- spec/logger_spec.rb
|
60
|
+
- spec/lumberjack_spec.rb
|
61
|
+
- spec/rack/unit_of_work_spec.rb
|
62
|
+
- spec/severity_spec.rb
|
63
|
+
- spec/spec_helper.rb
|
64
|
+
- spec/template_spec.rb
|
65
|
+
homepage: http://github.com/bdurand/lumberjack
|
66
|
+
licenses: []
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options:
|
70
|
+
- --charset=UTF-8
|
71
|
+
- --main
|
72
|
+
- README.rdoc
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.0.14
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: A simple, powerful, and very fast logging utility that can be a drop in replacement
|
91
|
+
for Logger or ActiveSupport::BufferedLogger.
|
92
|
+
test_files: []
|