hatchet 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hatchet/plain_formatter.rb +29 -0
- data/lib/hatchet/version.rb +1 -1
- data/lib/hatchet.rb +1 -0
- data/spec/plain_formatter_spec.rb +18 -0
- data/spec/simple_formatter_spec.rb +1 -1
- metadata +6 -3
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
module Hatchet
|
4
|
+
|
5
|
+
# Public: Plain formatter class. Outputs messages with just the given message.
|
6
|
+
#
|
7
|
+
# Useful for Rails in development mode where the log messages are intended to
|
8
|
+
# be human readable rather than useful for grepping, etc.
|
9
|
+
#
|
10
|
+
class PlainFormatter
|
11
|
+
|
12
|
+
# Public: Returns the formatted message.
|
13
|
+
#
|
14
|
+
# level - The severity of the log message.
|
15
|
+
# context - The context of the log message.
|
16
|
+
# message - The message provided by the log caller.
|
17
|
+
#
|
18
|
+
# Returns messages in the format:
|
19
|
+
#
|
20
|
+
# MESSAGE
|
21
|
+
#
|
22
|
+
def format(level, context, message)
|
23
|
+
message.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
data/lib/hatchet/version.rb
CHANGED
data/lib/hatchet.rb
CHANGED
@@ -6,6 +6,7 @@ require_relative 'hatchet/delegating_formatter'
|
|
6
6
|
require_relative 'hatchet/hatchet_logger'
|
7
7
|
require_relative 'hatchet/logger_appender'
|
8
8
|
require_relative 'hatchet/message'
|
9
|
+
require_relative 'hatchet/plain_formatter'
|
9
10
|
require_relative 'hatchet/simple_formatter'
|
10
11
|
require_relative 'hatchet/standard_formatter'
|
11
12
|
require_relative 'hatchet/version'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require_relative 'spec_helper'
|
4
|
+
|
5
|
+
describe PlainFormatter do
|
6
|
+
let(:subject) { PlainFormatter.new }
|
7
|
+
|
8
|
+
describe 'when formatting a message' do
|
9
|
+
before do
|
10
|
+
@message = subject.format(:info, 'Custom::Context', ' Hello, World ')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'outputs the message in the MESSAGE format' do
|
14
|
+
assert ' Hello, World ' == @message, "got #{@message}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -10,7 +10,7 @@ describe SimpleFormatter do
|
|
10
10
|
@message = subject.format(:info, 'Custom::Context', 'Hello, World')
|
11
11
|
end
|
12
12
|
|
13
|
-
it 'outputs the message in the LEVEL CONTEXT - MESSAGE format' do
|
13
|
+
it 'outputs the message in the LEVEL - CONTEXT - MESSAGE format' do
|
14
14
|
assert 'INFO - Custom::Context - Hello, World' == @message, "got #{@message}"
|
15
15
|
end
|
16
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hatchet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Logging library that provides the ability to add class/module specific
|
15
15
|
filters
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- lib/hatchet/level_manager.rb
|
26
26
|
- lib/hatchet/logger_appender.rb
|
27
27
|
- lib/hatchet/message.rb
|
28
|
+
- lib/hatchet/plain_formatter.rb
|
28
29
|
- lib/hatchet/railtie.rb
|
29
30
|
- lib/hatchet/simple_formatter.rb
|
30
31
|
- lib/hatchet/standard_formatter.rb
|
@@ -39,6 +40,7 @@ files:
|
|
39
40
|
- spec/logger_appender_spec.rb
|
40
41
|
- spec/logger_spec.rb
|
41
42
|
- spec/message_spec.rb
|
43
|
+
- spec/plain_formatter_spec.rb
|
42
44
|
- spec/simple_formatter_spec.rb
|
43
45
|
- spec/spec_helper.rb
|
44
46
|
- spec/standard_formatter_spec.rb
|
@@ -63,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
65
|
version: '0'
|
64
66
|
requirements: []
|
65
67
|
rubyforge_project:
|
66
|
-
rubygems_version: 1.8.
|
68
|
+
rubygems_version: 1.8.17
|
67
69
|
signing_key:
|
68
70
|
specification_version: 3
|
69
71
|
summary: Logging library that provides the ability to add class/module specific filters
|
@@ -77,6 +79,7 @@ test_files:
|
|
77
79
|
- spec/logger_appender_spec.rb
|
78
80
|
- spec/logger_spec.rb
|
79
81
|
- spec/message_spec.rb
|
82
|
+
- spec/plain_formatter_spec.rb
|
80
83
|
- spec/simple_formatter_spec.rb
|
81
84
|
- spec/spec_helper.rb
|
82
85
|
- spec/standard_formatter_spec.rb
|