sixarm_ruby_pro_logger 2.0.1 → 2.0.3
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Rakefile +19 -4
- data/lib/sixarm_ruby_pro_logger/pro_logger.rb +116 -0
- data/lib/sixarm_ruby_pro_logger.rb +1 -114
- data/test/sixarm_ruby_pro_logger_test/pro_logger_test.rb +81 -0
- data/test/sixarm_ruby_pro_logger_test.rb +9 -82
- data.tar.gz.sig +0 -0
- metadata +120 -28
- metadata.gz.sig +0 -0
- data/.gemtest +0 -0
- data/CONTRIBUTING.md +0 -28
- data/README.md +0 -151
- data/VERSION +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29b37853697d8e9b9e210dd7e46194ed38a98143
|
4
|
+
data.tar.gz: ca29ca91e2ad1ab218b505e113fd04d252780834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea5e4c90ce8d7028e2cbc7f176a25aa386f789698cb7c5b19cebcd20946b6ac4a6a9f430a250210dc6cf74b910407d1355b21dd83e9fdd2cbb0b16a30f9aa75
|
7
|
+
data.tar.gz: 82214415802efcd301fd9e346d6663fc899072fbdd10f884974da815915b3a3fbe41cfa528f8e868ff9b2d82349b769f867887662e572a46d032267c598c84d4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Rakefile
CHANGED
@@ -1,8 +1,23 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "rake"
|
3
|
+
require "rake/testtask"
|
4
4
|
|
5
5
|
Rake::TestTask.new(:test) do |t|
|
6
|
-
t.libs
|
7
|
-
t.pattern =
|
6
|
+
t.libs.push("lib", "test")
|
7
|
+
t.pattern = "test/**/*.rb"
|
8
8
|
end
|
9
|
+
task :default => [:test]
|
10
|
+
task :default => [:test]
|
11
|
+
task :default => [:test]
|
12
|
+
task :default => [:test]
|
13
|
+
task :default => [:test]
|
14
|
+
task :default => [:test]
|
15
|
+
task :default => [:test]
|
16
|
+
task :default => [:test]
|
17
|
+
task :default => [:test]
|
18
|
+
task :default => [:test]
|
19
|
+
task :default => [:test]
|
20
|
+
task :default => [:test]
|
21
|
+
task :default => [:test]
|
22
|
+
task :default => [:test]
|
23
|
+
task :default => [:test]
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin rdoc
|
3
|
+
ProLogger class for logging more information in a more useful format.
|
4
|
+
=end
|
5
|
+
|
6
|
+
require "logger"
|
7
|
+
|
8
|
+
class ProLogger < Logger
|
9
|
+
|
10
|
+
attr_accessor :time_format
|
11
|
+
attr_accessor :progname
|
12
|
+
attr_accessor :hostname
|
13
|
+
attr_accessor :pid
|
14
|
+
attr_accessor :message_separator
|
15
|
+
attr_accessor :backtrace_separator
|
16
|
+
attr_accessor :line_separator
|
17
|
+
|
18
|
+
# Initialize the Rails logger formatter.
|
19
|
+
#
|
20
|
+
# Options:
|
21
|
+
#
|
22
|
+
# * time_format: A format string for the `time.strftime` method.
|
23
|
+
# Default is `"%Y-%m-%dT%H:%M:%SZ"` which is ISO 8601 format.
|
24
|
+
#
|
25
|
+
# * progname: The running program name.
|
26
|
+
# Default is `$PROGRAM_NAME`.
|
27
|
+
#
|
28
|
+
# * hostname: The server host name.
|
29
|
+
# Default is `Socket.gethostname`.
|
30
|
+
#
|
31
|
+
# * pid: The process id number.
|
32
|
+
# Default is `Process.pid`.
|
33
|
+
#
|
34
|
+
# * message_separator: Text to use to join mutiple messages.
|
35
|
+
# Default is " ... ".
|
36
|
+
#
|
37
|
+
# * backtrace_separator: Print this between exception backtrace lines.
|
38
|
+
# Default is " ... ".
|
39
|
+
#
|
40
|
+
# * line_separator: Change any message newlines to this text.
|
41
|
+
# Default is " ... ".
|
42
|
+
#
|
43
|
+
# @param [Hash] options
|
44
|
+
#
|
45
|
+
def initialize(options={})
|
46
|
+
@time_format = (options[:time_format] || "%Y-%m-%dT%H:%M:%SZ").to_s
|
47
|
+
@progname = (options[:progname] || $PROGRAM_NAME).to_s
|
48
|
+
@hostname = (options[:hostname] || (require('socket') && Socket.gethostname)).to_s
|
49
|
+
@pid = (options[:pid] || Process.pid).to_s
|
50
|
+
@message_separator = (options[:message_separator] || " ... ").to_s
|
51
|
+
@backtrace_separator = (options[:backtrace_separator] || " ... ").to_s
|
52
|
+
@line_separator = (options[:line_separator] || " ... ").to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
# Call the formatter.
|
56
|
+
#
|
57
|
+
# All of the params will be converted to strings;
|
58
|
+
# it's fine to send objects instead of strings.
|
59
|
+
#
|
60
|
+
# We strip the message of extraneous whitespace.
|
61
|
+
#
|
62
|
+
# See #initialize for the defaults.
|
63
|
+
#
|
64
|
+
# @param severity [String] the severity object, such as `"INFO"`.
|
65
|
+
# @param time [Time] the time, typically `Time.now.utc`.
|
66
|
+
# @param progname [String] the program name, which is anything you like.
|
67
|
+
# @param msg [String] the message.
|
68
|
+
#
|
69
|
+
def call(severity, time, progname, msg)
|
70
|
+
"#{time_string(time)} #{progname_string(progname)} #{hostname} #{pid} #{severity_string(severity)} #{message_string(msg)}\n"
|
71
|
+
end
|
72
|
+
|
73
|
+
def time_string(time)
|
74
|
+
time.utc.strftime(time_format)
|
75
|
+
end
|
76
|
+
|
77
|
+
def progname_string(progname)
|
78
|
+
(progname || self.progname).to_s
|
79
|
+
end
|
80
|
+
|
81
|
+
def severity_string(severity)
|
82
|
+
(severity || self.severity).to_s
|
83
|
+
end
|
84
|
+
|
85
|
+
def message_string(msg)
|
86
|
+
s = \
|
87
|
+
case msg
|
88
|
+
when ::String
|
89
|
+
message_string_when_string(msg)
|
90
|
+
when ::Exception
|
91
|
+
message_string_when_exception(msg)
|
92
|
+
when ::Array
|
93
|
+
message_string_when_array(msg)
|
94
|
+
else
|
95
|
+
message_string_when_object(msg)
|
96
|
+
end
|
97
|
+
return s.gsub(/\n/, line_separator).lstrip
|
98
|
+
end
|
99
|
+
|
100
|
+
def message_string_when_string(msg)
|
101
|
+
msg
|
102
|
+
end
|
103
|
+
|
104
|
+
def message_string_when_array(msg)
|
105
|
+
msg.map{|item| message_string(item)}.join(message_separator)
|
106
|
+
end
|
107
|
+
|
108
|
+
def message_string_when_exception(msg)
|
109
|
+
"#{msg.class} #{msg.message}: " + (msg.backtrace || []).join(backtrace_separator)
|
110
|
+
end
|
111
|
+
|
112
|
+
def message_string_when_object(msg)
|
113
|
+
msg.inspect
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
@@ -3,117 +3,4 @@
|
|
3
3
|
Please see README
|
4
4
|
=end
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
class ProLogger < Logger
|
9
|
-
|
10
|
-
attr_accessor :time_format
|
11
|
-
attr_accessor :progname
|
12
|
-
attr_accessor :hostname
|
13
|
-
attr_accessor :pid
|
14
|
-
attr_accessor :message_separator
|
15
|
-
attr_accessor :backtrace_separator
|
16
|
-
attr_accessor :line_separator
|
17
|
-
|
18
|
-
# Initialize the Rails logger formatter.
|
19
|
-
#
|
20
|
-
# Options:
|
21
|
-
#
|
22
|
-
# * time_format: A format string for the `time.strftime` method.
|
23
|
-
# Default is `"%Y-%m-%dT%H:%M:%SZ"` which is ISO 8601 format.
|
24
|
-
#
|
25
|
-
# * progname: The running program name.
|
26
|
-
# Default is `$PROGRAM_NAME`.
|
27
|
-
#
|
28
|
-
# * hostname: The server host name.
|
29
|
-
# Default is `Socket.gethostname`.
|
30
|
-
#
|
31
|
-
# * pid: The process id number.
|
32
|
-
# Default is `Process.pid`.
|
33
|
-
#
|
34
|
-
# * message_separator: Print this between mutiple messages.
|
35
|
-
# Default is "\n".
|
36
|
-
#
|
37
|
-
# * backtrace_separator: Print this between exception backtrace lines.
|
38
|
-
# Default is "\n".
|
39
|
-
#
|
40
|
-
# * line_separator: Print this between message lines.
|
41
|
-
# Default is "\n", which is the same as no change.
|
42
|
-
#
|
43
|
-
# @param [Hash] options
|
44
|
-
#
|
45
|
-
def initialize(options={})
|
46
|
-
@time_format = (options[:time_format] || "%Y-%m-%dT%H:%M:%SZ").to_s
|
47
|
-
@progname = (options[:progname] || $PROGRAM_NAME).to_s
|
48
|
-
@hostname = (options[:hostname] || (require('socket') && Socket.gethostname)).to_s
|
49
|
-
@pid = (options[:pid] || Process.pid).to_s
|
50
|
-
@message_separator = (options[:message_separator] || "\n").to_s
|
51
|
-
@backtrace_separator = (options[:backtrace_separator] || "\n").to_s
|
52
|
-
@line_separator = (options[:line_separator] || "\n").to_s
|
53
|
-
end
|
54
|
-
|
55
|
-
# Call the formatter.
|
56
|
-
#
|
57
|
-
# All of the params will be converted to strings;
|
58
|
-
# it's fine to send objects instead of strings.
|
59
|
-
#
|
60
|
-
# We strip the message of extraneous whitespace.
|
61
|
-
#
|
62
|
-
# See #initialize for the defaults.
|
63
|
-
#
|
64
|
-
# @param severity [String] the severity object, such as `"INFO"`.
|
65
|
-
# @param time [Time] the time, typically `Time.now.utc`.
|
66
|
-
# @param progname [String] the program name, which is anything you like.
|
67
|
-
# @param msg [String] the message.
|
68
|
-
#
|
69
|
-
def call(severity, time, progname, msg)
|
70
|
-
"#{time_string(time)} #{progname_string(progname)} #{hostname} #{pid} #{severity_string(severity)} #{message_string(msg)}\n"
|
71
|
-
end
|
72
|
-
|
73
|
-
def time_string(time)
|
74
|
-
time.utc.strftime(time_format)
|
75
|
-
end
|
76
|
-
|
77
|
-
def progname_string(progname)
|
78
|
-
(progname || self.progname).to_s
|
79
|
-
end
|
80
|
-
|
81
|
-
def severity_string(severity)
|
82
|
-
(severity || self.severity).to_s
|
83
|
-
end
|
84
|
-
|
85
|
-
def message_string(msg)
|
86
|
-
s = \
|
87
|
-
case msg
|
88
|
-
when ::String
|
89
|
-
message_string_when_string(msg)
|
90
|
-
when ::Exception
|
91
|
-
message_string_when_exception(msg)
|
92
|
-
when ::Array
|
93
|
-
message_string_when_array(msg)
|
94
|
-
else
|
95
|
-
message_string_when_object(msg)
|
96
|
-
end
|
97
|
-
if line_separator && line_separator != "\n"
|
98
|
-
s = s.gsub!(/\n/, line_separator)
|
99
|
-
end
|
100
|
-
return s.lstrip
|
101
|
-
end
|
102
|
-
|
103
|
-
def message_string_when_string(msg)
|
104
|
-
msg
|
105
|
-
end
|
106
|
-
|
107
|
-
def message_string_when_array(msg)
|
108
|
-
msg.map{|item| message_string(item)}.join(message_separator)
|
109
|
-
end
|
110
|
-
|
111
|
-
def message_string_when_exception(msg)
|
112
|
-
"#{msg.class} #{msg.message}: " + (msg.backtrace || []).join(backtrace_separator)
|
113
|
-
end
|
114
|
-
|
115
|
-
def message_string_when_object(msg)
|
116
|
-
msg.inspect
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
6
|
+
require_relative "sixarm_ruby_pro_logger/pro_logger"
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "sixarm_ruby_pro_logger_test"
|
3
|
+
|
4
|
+
class ProLoggerTest < Minitest::Test
|
5
|
+
|
6
|
+
def test_initialize
|
7
|
+
x = ProLogger.new(
|
8
|
+
:time_format => "my_time_format",
|
9
|
+
:progname => "my_progname",
|
10
|
+
:hostname => "my_hostname",
|
11
|
+
:pid => "my_pid",
|
12
|
+
:message_separator => "my_message_separator",
|
13
|
+
:backtrace_separator => "my_backtrace_separator",
|
14
|
+
:line_separator => "my_line_separator",
|
15
|
+
)
|
16
|
+
assert_equal("my_time_format", x.time_format)
|
17
|
+
assert_equal("my_progname", x.progname)
|
18
|
+
assert_equal("my_hostname", x.hostname)
|
19
|
+
assert_equal("my_pid", x.pid)
|
20
|
+
assert_equal("my_message_separator", x.message_separator)
|
21
|
+
assert_equal("my_backtrace_separator", x.backtrace_separator)
|
22
|
+
assert_equal("my_line_separator", x.line_separator)
|
23
|
+
end
|
24
|
+
|
25
|
+
LOGGER = ProLogger.new
|
26
|
+
|
27
|
+
def test_format_message
|
28
|
+
LOGGER.hostname = "my_hostname"
|
29
|
+
LOGGER.pid = "my_pid"
|
30
|
+
severity = "my_severity"
|
31
|
+
time = Time.now
|
32
|
+
progname = "my_progname"
|
33
|
+
msg = "my_msg"
|
34
|
+
s = LOGGER.call(severity, time, progname, msg)
|
35
|
+
assert(s=~/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ my_progname my_hostname my_pid my_severity my_msg\n$/, s)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_time_string
|
39
|
+
assert_match(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$/, LOGGER.time_string(Time.now))
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_message_string_when_string
|
43
|
+
msg = "foo"
|
44
|
+
assert_equal("foo", LOGGER.message_string(msg))
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_message_string_when_string_with_leading_whitespace
|
48
|
+
msg = " foo"
|
49
|
+
assert_equal("foo", LOGGER.message_string(msg))
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_message_string_when_string_with_multiple_lines
|
53
|
+
sep = LOGGER.line_separator
|
54
|
+
msg = "abc\ndef\nghi"
|
55
|
+
assert_equal("abc#{sep}def#{sep}ghi", LOGGER.message_string(msg))
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_message_string_when_array
|
59
|
+
sep = LOGGER.message_separator
|
60
|
+
msg = ['abc','def','ghi']
|
61
|
+
assert_equal("abc#{sep}def#{sep}ghi", LOGGER.message_string(msg))
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_message_string_when_exception
|
65
|
+
msg = RuntimeError.new("hello")
|
66
|
+
msg.set_backtrace(['abc:1','def:2','ghi:3'])
|
67
|
+
sep = LOGGER.backtrace_separator
|
68
|
+
assert_equal("RuntimeError hello: abc:1#{sep}def:2#{sep}ghi:3", LOGGER.message_string_when_exception(msg))
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_message_string_when_object_using_inspect_on_a_number
|
72
|
+
msg = 123
|
73
|
+
assert_equal("123", LOGGER.message_string_when_object(msg))
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_message_string_when_object_using_inspect_on_a_hash
|
77
|
+
msg = {:a => :b}
|
78
|
+
assert_equal("{:a=>:b}", LOGGER.message_string_when_object(msg))
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -1,84 +1,11 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "minitest/autorun"
|
3
|
+
require "coveralls"
|
4
|
+
require "simplecov"
|
5
|
+
Coveralls.wear!
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
Coveralls::SimpleCov::Formatter
|
9
|
+
]
|
4
10
|
SimpleCov.start
|
5
|
-
require
|
6
|
-
|
7
|
-
class ProLoggerTest < Minitest::Test
|
8
|
-
|
9
|
-
def test_initialize
|
10
|
-
x = ProLogger.new(
|
11
|
-
:time_format => "my_time_format",
|
12
|
-
:progname => "my_progname",
|
13
|
-
:hostname => "my_hostname",
|
14
|
-
:pid => "my_pid",
|
15
|
-
:message_separator => "my_message_separator",
|
16
|
-
:backtrace_separator => "my_backtrace_separator",
|
17
|
-
:line_separator => "my_line_separator",
|
18
|
-
)
|
19
|
-
assert_equal("my_time_format", x.time_format)
|
20
|
-
assert_equal("my_progname", x.progname)
|
21
|
-
assert_equal("my_hostname", x.hostname)
|
22
|
-
assert_equal("my_pid", x.pid)
|
23
|
-
assert_equal("my_message_separator", x.message_separator)
|
24
|
-
assert_equal("my_backtrace_separator", x.backtrace_separator)
|
25
|
-
assert_equal("my_line_separator", x.line_separator)
|
26
|
-
end
|
27
|
-
|
28
|
-
LOGGER = ProLogger.new
|
29
|
-
|
30
|
-
def test_format_message
|
31
|
-
LOGGER.hostname = "my_hostname"
|
32
|
-
LOGGER.pid = "my_pid"
|
33
|
-
severity = "my_severity"
|
34
|
-
time = Time.now
|
35
|
-
progname = "my_progname"
|
36
|
-
msg = "my_msg"
|
37
|
-
s = LOGGER.call(severity, time, progname, msg)
|
38
|
-
assert(s=~/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ my_progname my_hostname my_pid my_severity my_msg\n$/, s)
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_time_string
|
42
|
-
assert_match(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$/, LOGGER.time_string(Time.now))
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_message_string_when_string
|
46
|
-
msg = "foo"
|
47
|
-
assert_equal("foo", LOGGER.message_string(msg))
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_message_string_when_string_with_leading_whitespace
|
51
|
-
msg = " foo"
|
52
|
-
assert_equal("foo", LOGGER.message_string(msg))
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_message_string_when_string_with_multiple_lines
|
56
|
-
sep = LOGGER.line_separator
|
57
|
-
msg = "abc\ndef\nghi"
|
58
|
-
assert_equal("abc#{sep}def#{sep}ghi", LOGGER.message_string(msg))
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_message_string_when_array
|
62
|
-
sep = LOGGER.message_separator
|
63
|
-
msg = ['abc','def','ghi']
|
64
|
-
assert_equal("abc#{sep}def#{sep}ghi", LOGGER.message_string(msg))
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_message_string_when_exception
|
68
|
-
msg = RuntimeError.new("hello")
|
69
|
-
msg.set_backtrace(['abc:1','def:2','ghi:3'])
|
70
|
-
sep = LOGGER.backtrace_separator
|
71
|
-
assert_equal("RuntimeError hello: abc:1#{sep}def:2#{sep}ghi:3", LOGGER.message_string_when_exception(msg))
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_message_string_when_object_using_inspect_on_a_number
|
75
|
-
msg = 123
|
76
|
-
assert_equal("123", LOGGER.message_string_when_object(msg))
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_message_string_when_object_using_inspect_on_a_hash
|
80
|
-
msg = {:a => :b}
|
81
|
-
assert_equal("{:a=>:b}", LOGGER.message_string_when_object(msg))
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
11
|
+
require "sixarm_ruby_pro_logger"
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sixarm_ruby_pro_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SixArm
|
@@ -10,41 +10,133 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIGCTCCA/GgAwIBAgIJAK3igyLv2hNNMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV
|
14
|
+
BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp
|
15
|
+
c2NvMQ8wDQYDVQQKEwZTaXhBcm0xEzARBgNVBAMTCnNpeGFybS5jb20wHhcNMTUw
|
16
|
+
MzE0MjA0MTE5WhcNMTcxMjA4MjA0MTE5WjBgMQswCQYDVQQGEwJVUzETMBEGA1UE
|
17
|
+
CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEPMA0GA1UEChMG
|
18
|
+
U2l4QXJtMRMwEQYDVQQDEwpzaXhhcm0uY29tMIICIjANBgkqhkiG9w0BAQEFAAOC
|
19
|
+
Ag8AMIICCgKCAgEA4et7SlePzuE46eK5BAVVGg+yWt6FkX7xcLt3Uun9RntKPSuR
|
20
|
+
TbS/+KBqbja5reZD64hdQ9npxpQPKafxUm+RlCd9F5KFxwi8G9usKzCTPOwUeDI2
|
21
|
+
TNEfC+1eRU19QuEW58ZC0pC/bx5Zmp6/DTD6VV+qxKEE9U1M5P85LNkwnxqmRIMR
|
22
|
+
AN8VKOG+GRGOMNDGZ8Kp4h5V3Wyu0N7anY8AUveIx1SyLrEbAhcWp1asLs+/H22q
|
23
|
+
92YFgnwTtnDpZsAmNgZrVw9xY0v79BXqPoyKIl2psPfZi2mOIWi/N+cx6LGF1G+B
|
24
|
+
b+NZdAgwuLyFOoVknkTqsuYEsFhxz0dqDUgM/RvGrADxZk6yUD/1lBNTWnIDVKaN
|
25
|
+
Onu08gOb1lfn21Sbd5r/K32hngasiEuDvh61pJVwszBuFv3v++hVlvNzHw9oT7wc
|
26
|
+
W0z258Qw6fkPhozF5l+zaR+xPZG/4Kk4vc3D4mnw5MEHna6Q9rVsVktqGuIOie8Q
|
27
|
+
5MQAyjdNxywnl7GDllX97oVN+35JbyTePeUyZZnk5tb4p6BlYrd3rtQ2Te7tkQRz
|
28
|
+
8T4Scy5THaPvxf8SsfDGSj3AVPARvSX//hSFFxJM+up+S1jsquU0RjBU52nCdh7p
|
29
|
+
1hBZ1nqfVPeSktx3F+R2RZBPA692UKjpSA7r2vOEfoh3rUTEsNUBQGpPg2MCAwEA
|
30
|
+
AaOBxTCBwjAdBgNVHQ4EFgQUHnpLsysq561sVXhWi+3NoSb9n94wgZIGA1UdIwSB
|
31
|
+
ijCBh4AUHnpLsysq561sVXhWi+3NoSb9n96hZKRiMGAxCzAJBgNVBAYTAlVTMRMw
|
32
|
+
EQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMQ8wDQYD
|
33
|
+
VQQKEwZTaXhBcm0xEzARBgNVBAMTCnNpeGFybS5jb22CCQCt4oMi79oTTTAMBgNV
|
34
|
+
HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4ICAQCYcCnvJpEhpo5mdVM8JDUuUZFt
|
35
|
+
qP2Kvj9J6tqugO+cuUF2S/ro4gdEQhl7Gv6+DCWHd0FQWJBSXMsZ9a6RhFGAcE5C
|
36
|
+
egK706Gh40yNeobd1aoUh+Pn17kYH2WSBRC+KsIvhZaAnra/1JPZItoge64GS+lM
|
37
|
+
PJJbVrtSati++s39wnss1QlMy9TXoesmR8vqsOU0XdCnK5hOun5RA8SYDWLffsfG
|
38
|
+
E3hvCg4C5viEkPY0YdC0KMSqs5kIA2nCUiqpkwIOa36rVEwiKiU7OCfE3u3baDpL
|
39
|
+
FlfMBznZKOdxDFAmNaxvXBe2XeTzrZPvJtnNLWL6K4LaBHhq3bBdh1Hge0iMkpQ7
|
40
|
+
RTIGlfhlIFkMV3wT0LTsNznUPsoo6e+IW/tDrk23mrNRY6QynTETb+QVIevuzD9m
|
41
|
+
Drcxp/zlVhud+a0ezdnyNvF520arJWvqA4GrOo8F+TT2vVrjscgYjiVGdSq+8wQv
|
42
|
+
Efa5jhe8QwG7R1rdpMMP5yBSAqWuFBczMveX5j4rp9Ifw5/XsZbgwcmdm26bjhzh
|
43
|
+
w2grAHIhvR9mztm6uXQlZhv1fu3P+RWHDSYhnZSCJSCdxPzQJ1mG5T5ahiL3HvCZ
|
44
|
+
2AC9FOGkybW6DJEFSFFMlNk0IILsa/gNp8ufGuTVLWF9FUUdMNK+TMbghnifT8/1
|
45
|
+
n+ES/gQPOnvmVkLDGw==
|
32
46
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
34
|
-
dependencies:
|
47
|
+
date: 2015-07-20 00:00:00.000000000 Z
|
48
|
+
dependencies:
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: minitest
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 5.7.0
|
56
|
+
- - "<"
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '6'
|
59
|
+
type: :development
|
60
|
+
prerelease: false
|
61
|
+
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 5.7.0
|
66
|
+
- - "<"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 10.4.2
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '11'
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 10.4.2
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '11'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: simplecov
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.10.0
|
96
|
+
- - "<"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '2'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 0.10.0
|
106
|
+
- - "<"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '2'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: coveralls
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 0.8.2
|
116
|
+
- - "<"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '2'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.8.2
|
126
|
+
- - "<"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '2'
|
35
129
|
description: Logs more information than the typical Ruby logger.
|
36
130
|
email: sixarm@sixarm.com
|
37
131
|
executables: []
|
38
132
|
extensions: []
|
39
133
|
extra_rdoc_files: []
|
40
134
|
files:
|
41
|
-
- ".gemtest"
|
42
|
-
- CONTRIBUTING.md
|
43
|
-
- README.md
|
44
135
|
- Rakefile
|
45
|
-
- VERSION
|
46
136
|
- lib/sixarm_ruby_pro_logger.rb
|
137
|
+
- lib/sixarm_ruby_pro_logger/pro_logger.rb
|
47
138
|
- test/sixarm_ruby_pro_logger_test.rb
|
139
|
+
- test/sixarm_ruby_pro_logger_test/pro_logger_test.rb
|
48
140
|
homepage: http://sixarm.com/
|
49
141
|
licenses:
|
50
142
|
- BSD
|
@@ -69,10 +161,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
161
|
version: '0'
|
70
162
|
requirements: []
|
71
163
|
rubyforge_project:
|
72
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.4.8
|
73
165
|
signing_key:
|
74
166
|
specification_version: 4
|
75
167
|
summary: SixArm.com » Ruby » ProLogger custom logger for Rails
|
76
168
|
test_files:
|
77
169
|
- test/sixarm_ruby_pro_logger_test.rb
|
78
|
-
|
170
|
+
- test/sixarm_ruby_pro_logger_test/pro_logger_test.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/.gemtest
DELETED
File without changes
|
data/CONTRIBUTING.md
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
Thank you for contributing!
|
4
|
-
|
5
|
-
If you would like to contribute a donation, an easy way is to use PayPal to sixarm@sixarm.com.
|
6
|
-
|
7
|
-
If you would like to contribute help, the next section is for you.
|
8
|
-
|
9
|
-
|
10
|
-
## Contributing to the source
|
11
|
-
|
12
|
-
We love pull requests for improvments to the source code and documentation.
|
13
|
-
|
14
|
-
There are three easy steps:
|
15
|
-
|
16
|
-
1. Fork the repo.
|
17
|
-
|
18
|
-
* Before you do any work please run our existing tests to make sure the code runs cleanly.
|
19
|
-
|
20
|
-
2. Work as you like.
|
21
|
-
|
22
|
-
* Please create tests. This helps us know that all your code runs cleanly.
|
23
|
-
|
24
|
-
3. Push to your fork and submit a pull request.
|
25
|
-
|
26
|
-
* We'll take a look as soon as we can; this is typically within a business day.
|
27
|
-
|
28
|
-
Thank you again!
|
data/README.md
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
# SixArm.com » Ruby » <br> ProLogger custom logger with better information
|
2
|
-
|
3
|
-
* Doc: <http://sixarm.com/sixarm_ruby_pro_logger/doc>
|
4
|
-
* Gem: <http://rubygems.org/gems/sixarm_ruby_pro_logger>
|
5
|
-
* Repo: <http://github.com/sixarm/sixarm_ruby_pro_logger>
|
6
|
-
* Email: Joel Parker Henderson, <joel@sixarm.com>
|
7
|
-
|
8
|
-
|
9
|
-
## Introduction
|
10
|
-
|
11
|
-
ProLogger is a custom logger formatter for Rails that prints these:
|
12
|
-
|
13
|
-
* Time stamp: such as ISO 8601 format using YYYY-MM-DD and HH:MM:SS.
|
14
|
-
* Program name: such as `$PROGRAM_NAME`
|
15
|
-
* Hostname: such as `Socket.gethostname`.
|
16
|
-
* Process Id: such as `Process.pid`.
|
17
|
-
* Severity: such as debug, info, warn, error, and fatal.
|
18
|
-
* Message: a string, exception, array, or any object that has a `inspect` method
|
19
|
-
|
20
|
-
Example setup:
|
21
|
-
|
22
|
-
Rails.logger.formatter = ProLogger.new
|
23
|
-
|
24
|
-
Example use:
|
25
|
-
|
26
|
-
logger.info("Hello")
|
27
|
-
=> "2011-12-31T12:59:59Z my_program my.example.com 1000 Hello"
|
28
|
-
|
29
|
-
|
30
|
-
## Options
|
31
|
-
|
32
|
-
Intialize options:
|
33
|
-
|
34
|
-
* time_format: A format string for the `time.strftime` method.
|
35
|
-
Defaults to `"%Y-%m-%dT%H:%M:%SZ"` which is ISO 8601 format.
|
36
|
-
|
37
|
-
* progname: The running program name.
|
38
|
-
Default is `$PROGRAM_NAME`.
|
39
|
-
|
40
|
-
* hostname: The server host name.
|
41
|
-
Default is `Socket.gethostname`.
|
42
|
-
|
43
|
-
* pid: The process id number.
|
44
|
-
Default is `Process.pid`.
|
45
|
-
|
46
|
-
* message_separator: Print this between mutiple messages.
|
47
|
-
Default is "\n".
|
48
|
-
|
49
|
-
* backtrace_separator: Print this between exception backtrace lines.
|
50
|
-
Default is "\n".
|
51
|
-
|
52
|
-
* line_separator: Print this between message lines.
|
53
|
-
Default is "\n", which is the same as no change.
|
54
|
-
|
55
|
-
Example:
|
56
|
-
|
57
|
-
Rails.logger.formatter = ProLogger.new(
|
58
|
-
strftime: "%Y-%m-%dT%H:%M:%SZ",
|
59
|
-
progname: "my_program"
|
60
|
-
hostname: "my.example.com",
|
61
|
-
pid: 1000,
|
62
|
-
line_separator: " / "
|
63
|
-
backtrace_separator " \"
|
64
|
-
message_separator: " | "
|
65
|
-
)
|
66
|
-
|
67
|
-
The message can be:
|
68
|
-
|
69
|
-
* a string: print the string, with leading whitespace stripped, and newlines replaced by line_separator.
|
70
|
-
|
71
|
-
* an exception: print the class, message, and backtrace items separated by backtrace_separator.
|
72
|
-
|
73
|
-
* an array of messages: print the items in the array, separated by message_separator.
|
74
|
-
|
75
|
-
* any object: first convert it to a string using object.inspect, then print it as a string as above.
|
76
|
-
|
77
|
-
For docs go to <http://sixarm.com/sixarm_ruby_pro_logger/doc>
|
78
|
-
|
79
|
-
Want to help? We're happy to get pull requests.
|
80
|
-
|
81
|
-
|
82
|
-
## Install quickstart
|
83
|
-
|
84
|
-
Install:
|
85
|
-
|
86
|
-
gem install sixarm_ruby_pro_logger
|
87
|
-
|
88
|
-
Bundler:
|
89
|
-
|
90
|
-
gem "sixarm_ruby_pro_logger", "~>2.0.1"
|
91
|
-
|
92
|
-
Require:
|
93
|
-
|
94
|
-
require "sixarm_ruby_pro_logger"
|
95
|
-
|
96
|
-
|
97
|
-
## Install with security (optional)
|
98
|
-
|
99
|
-
To enable high security for all our gems:
|
100
|
-
|
101
|
-
wget http://sixarm.com/sixarm.pem
|
102
|
-
gem cert --add sixarm.pem
|
103
|
-
gem sources --add http://sixarm.com
|
104
|
-
|
105
|
-
To install with high security:
|
106
|
-
|
107
|
-
gem install sixarm_ruby_pro_logger --test --trust-policy HighSecurity
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
## Thanks
|
112
|
-
|
113
|
-
Thanks to topfunky for the open source custom logger at:
|
114
|
-
https://github.com/topfunky/hodel_3000_compliant_logger/
|
115
|
-
|
116
|
-
|
117
|
-
## Changes
|
118
|
-
|
119
|
-
* 2014-03-16 2.0.1 Change defaults to use newlines for readability
|
120
|
-
* 2014-03-15 2.0.0 Upgrades to be a formatter plus new options
|
121
|
-
* 2012-03-14 1.1.0 Update docs, tests
|
122
|
-
* 2011-11-27 1.0.0 Publish
|
123
|
-
|
124
|
-
|
125
|
-
## License
|
126
|
-
|
127
|
-
You may choose any of these open source licenses:
|
128
|
-
|
129
|
-
* Apache License
|
130
|
-
* BSD License
|
131
|
-
* CreativeCommons License, Non-commercial Share Alike
|
132
|
-
* GNU General Public License Version 2 (GPL 2)
|
133
|
-
* GNU Lesser General Public License (LGPL)
|
134
|
-
* MIT License
|
135
|
-
* Perl Artistic License
|
136
|
-
* Ruby License
|
137
|
-
|
138
|
-
The software is provided "as is", without warranty of any kind,
|
139
|
-
express or implied, including but not limited to the warranties of
|
140
|
-
merchantability, fitness for a particular purpose and noninfringement.
|
141
|
-
|
142
|
-
In no event shall the authors or copyright holders be liable for any
|
143
|
-
claim, damages or other liability, whether in an action of contract,
|
144
|
-
tort or otherwise, arising from, out of or in connection with the
|
145
|
-
software or the use or other dealings in the software.
|
146
|
-
|
147
|
-
This license is for the included software that is created by SixArm;
|
148
|
-
some of the included software may have its own licenses, copyrights,
|
149
|
-
authors, etc. and these do take precedence over the SixArm license.
|
150
|
-
|
151
|
-
Copyright (c) 2005-2014 Joel Parker Henderson
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.0.1
|