logsly 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/Gemfile +0 -1
- data/{LICENSE.txt → LICENSE} +0 -0
- data/lib/logsly/colors.rb +121 -36
- data/lib/logsly/outputs.rb +151 -0
- data/lib/logsly/version.rb +1 -1
- data/lib/logsly.rb +34 -31
- data/logsly.gemspec +3 -3
- data/test/unit/colors_tests.rb +5 -5
- data/test/unit/logsly_tests.rb +18 -16
- data/test/unit/outputs_tests.rb +242 -0
- metadata +57 -73
- data/Rakefile +0 -1
- data/lib/logsly/base_output.rb +0 -64
- data/lib/logsly/file_output.rb +0 -17
- data/lib/logsly/stdout_output.rb +0 -13
- data/lib/logsly/syslog_output.rb +0 -26
- data/test/unit/base_output_tests.rb +0 -101
- data/test/unit/file_output_tests.rb +0 -58
- data/test/unit/stdout_output_tests.rb +0 -43
- data/test/unit/syslog_output_tests.rb +0 -68
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'assert'
|
2
|
-
require 'logsly/stdout_output'
|
3
|
-
|
4
|
-
require 'ostruct'
|
5
|
-
require 'logging'
|
6
|
-
require 'logsly'
|
7
|
-
|
8
|
-
class Logsly::StdoutOutput
|
9
|
-
|
10
|
-
class UnitTests < Assert::Context
|
11
|
-
desc "Logsly::StdoutOutput"
|
12
|
-
setup do
|
13
|
-
@logger = OpenStruct.new
|
14
|
-
@logger.debug_level = :white
|
15
|
-
@logger.pattern = '%d : %m\n'
|
16
|
-
|
17
|
-
Logsly.colors('a_color_scheme') do |logger|
|
18
|
-
debug logger.debug_level
|
19
|
-
end
|
20
|
-
|
21
|
-
@out = Logsly::StdoutOutput.new do |logger|
|
22
|
-
pattern logger.pattern
|
23
|
-
colors 'a_color_scheme'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
subject{ @out }
|
27
|
-
|
28
|
-
should "be an output handler" do
|
29
|
-
assert_kind_of Logsly::BaseOutput, subject
|
30
|
-
end
|
31
|
-
|
32
|
-
should "build a Logging stdout appender, passing args to the builds" do
|
33
|
-
appender = subject.to_appender @logger
|
34
|
-
|
35
|
-
assert_kind_of Logging::Appenders::Stdout, appender
|
36
|
-
assert_kind_of Logging::Layouts::Pattern, appender.layout
|
37
|
-
assert_equal '%d : %m\n', appender.layout.pattern
|
38
|
-
assert_kind_of Logging::ColorScheme, appender.layout.color_scheme
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'assert'
|
2
|
-
require 'logsly/syslog_output'
|
3
|
-
|
4
|
-
require 'ostruct'
|
5
|
-
require 'syslog'
|
6
|
-
require 'logging'
|
7
|
-
require 'logsly'
|
8
|
-
|
9
|
-
class Logsly::SyslogOutput
|
10
|
-
|
11
|
-
class UnitTests < Assert::Context
|
12
|
-
desc "Logsly::SyslogOutput"
|
13
|
-
setup do
|
14
|
-
@logger = OpenStruct.new
|
15
|
-
@logger.debug_level = :white
|
16
|
-
@logger.pattern = '%d : %m\n'
|
17
|
-
@logger.identity = "whatever"
|
18
|
-
@logger.facility = Syslog::LOG_LOCAL3
|
19
|
-
|
20
|
-
Logsly.colors('a_color_scheme') do |logger|
|
21
|
-
debug logger.debug_level
|
22
|
-
end
|
23
|
-
|
24
|
-
@out = Logsly::SyslogOutput.new do |logger|
|
25
|
-
identity logger.identity
|
26
|
-
facility logger.facility
|
27
|
-
|
28
|
-
pattern logger.pattern
|
29
|
-
colors 'a_color_scheme'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
subject{ @out }
|
33
|
-
|
34
|
-
should "be an output handler" do
|
35
|
-
assert_kind_of Logsly::BaseOutput, subject
|
36
|
-
end
|
37
|
-
|
38
|
-
should "build a Logging syslog appender, passing args to the builds" do
|
39
|
-
appender = subject.to_appender @logger
|
40
|
-
|
41
|
-
assert_kind_of Logging::Appenders::Syslog, appender
|
42
|
-
assert_kind_of Logging::Layouts::Pattern, appender.layout
|
43
|
-
assert_equal '%d : %m\n', appender.layout.pattern
|
44
|
-
assert_kind_of Logging::ColorScheme, appender.layout.color_scheme
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
class SyslogOutputDataTests < Assert::Context
|
50
|
-
desc "SyslogOutputData"
|
51
|
-
setup do
|
52
|
-
@data = Logsly::SyslogOutputData.new {}
|
53
|
-
end
|
54
|
-
subject{ @data }
|
55
|
-
|
56
|
-
should have_imeth :identity, :log_opts, :facility
|
57
|
-
|
58
|
-
should "default :log_opts" do
|
59
|
-
assert_equal (Syslog::LOG_PID | Syslog::LOG_CONS), subject.log_opts
|
60
|
-
end
|
61
|
-
|
62
|
-
should "default :facility" do
|
63
|
-
assert_equal Syslog::LOG_LOCAL0, subject.facility
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|