slog 1.1.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/README.md +2 -3
- data/VERSION +1 -1
- data/lib/slog/logger.rb +1 -21
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67e7a027681ba7bb31b5bcd3899e5a1aa669e981
|
4
|
+
data.tar.gz: f5ceb88785d4b120470c355dc55b546ff7ceeb8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22677a678ec8b93f849e974ba935f7129092fadedf12ee7930e12bc73bc14eae1f448ac09d8131ed555a9c87138bafc222386411b18ea965a9be1714f7bdc4d1
|
7
|
+
data.tar.gz: 7c214953cdfafc0675039e3007805bc4c812f37c8c70195e68ec7a4a68dc41b53034fec5441c6f358c222064037e48728b92457842581c3f711a8dc7a5c8c4b5
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.0
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Easy structured logging.
|
4
4
|
|
5
5
|
`Slog::Logger` extends the base `Logger` with JSON serialization, colorization,
|
6
|
-
and
|
6
|
+
and more. Output is suitable for collection by Logstash or Franz.
|
7
7
|
|
8
8
|
```ruby
|
9
9
|
require 'slog'
|
@@ -28,8 +28,7 @@ timestamp_format: '%FT%T.%3N%:z', # Set timestamp format (Time#strftime)
|
|
28
28
|
'info' => [ :green, :default ],
|
29
29
|
'warn' => [ :yellow, :default ],
|
30
30
|
'error' => [ :red, :default ],
|
31
|
-
'fatal' => [ :red, :black ]
|
32
|
-
'trace' => [ :magenta, :default ] }
|
31
|
+
'fatal' => [ :red, :black ] }
|
33
32
|
|
34
33
|
|
35
34
|
# These two are equivalent
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/lib/slog/logger.rb
CHANGED
@@ -5,24 +5,6 @@ require 'json'
|
|
5
5
|
require 'colorize'
|
6
6
|
|
7
7
|
|
8
|
-
# Extending the base Logger with TRACE capabilities.
|
9
|
-
class Logger
|
10
|
-
|
11
|
-
# Adding the new severity level
|
12
|
-
SEV_LABEL << 'TRACE'
|
13
|
-
|
14
|
-
# So we can reference it by name
|
15
|
-
TRACE = SEV_LABEL.index('TRACE')
|
16
|
-
|
17
|
-
# Send a TRACE-level log
|
18
|
-
def trace progname, &block
|
19
|
-
return true unless @trace
|
20
|
-
add TRACE, nil, progname, &block
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
8
|
|
27
9
|
module Slog
|
28
10
|
|
@@ -84,7 +66,7 @@ module Slog
|
|
84
66
|
# Set the formatter to work our magic
|
85
67
|
def set_formatter
|
86
68
|
self.formatter = proc do |severity, datetime, _, message|
|
87
|
-
severity.downcase
|
69
|
+
severity = severity.downcase
|
88
70
|
|
89
71
|
# If it ain't a structured log, it is now.
|
90
72
|
event = structure_event severity, datetime, message
|
@@ -127,8 +109,6 @@ module Slog
|
|
127
109
|
# Override the level setter to allow symbols and TRACE
|
128
110
|
def level= l
|
129
111
|
l = ::Logger.const_get l.upcase if l.is_a? Symbol
|
130
|
-
@trace = l == ::Logger::TRACE # TRACE is really a fancy DEBUG
|
131
|
-
l = ::Logger::DEBUG if @trace # Here's the proof.
|
132
112
|
super l
|
133
113
|
end
|
134
114
|
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Clemmer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
|
-
- - ~>
|
17
|
+
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: '0'
|
19
|
-
name: colorize
|
20
|
-
prerelease: false
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
description: Easy structured logging.
|
@@ -30,8 +30,9 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
-
- .gitignore
|
34
|
-
- .rubocop.yml
|
33
|
+
- ".gitignore"
|
34
|
+
- ".rubocop.yml"
|
35
|
+
- ".ruby-version"
|
35
36
|
- Gemfile
|
36
37
|
- LICENSE
|
37
38
|
- README.md
|
@@ -47,24 +48,24 @@ homepage: https://github.com/sczizzo/slog
|
|
47
48
|
licenses:
|
48
49
|
- ISC
|
49
50
|
metadata: {}
|
50
|
-
post_install_message:
|
51
|
+
post_install_message:
|
51
52
|
rdoc_options: []
|
52
53
|
require_paths:
|
53
54
|
- lib
|
54
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
56
|
requirements:
|
56
|
-
- -
|
57
|
+
- - ">="
|
57
58
|
- !ruby/object:Gem::Version
|
58
59
|
version: '0'
|
59
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
61
|
requirements:
|
61
|
-
- -
|
62
|
+
- - ">="
|
62
63
|
- !ruby/object:Gem::Version
|
63
64
|
version: '0'
|
64
65
|
requirements: []
|
65
|
-
rubyforge_project:
|
66
|
-
rubygems_version: 2.
|
67
|
-
signing_key:
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 2.5.1
|
68
|
+
signing_key:
|
68
69
|
specification_version: 4
|
69
70
|
summary: Easy structured logging
|
70
71
|
test_files:
|