logsly 1.1.0 → 1.2.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.
@@ -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