cogger 0.24.1 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +238 -137
- data/cogger.gemspec +1 -1
- data/lib/cogger/configuration.rb +6 -3
- data/lib/cogger/entry.rb +5 -2
- data/lib/cogger/formatters/abstract.rb +44 -0
- data/lib/cogger/formatters/color.rb +11 -6
- data/lib/cogger/formatters/crash.rb +11 -6
- data/lib/cogger/formatters/json.rb +17 -15
- data/lib/cogger/formatters/parsers/abstract.rb +10 -4
- data/lib/cogger/formatters/parsers/combined.rb +3 -3
- data/lib/cogger/formatters/parsers/element.rb +16 -14
- data/lib/cogger/formatters/parsers/emoji.rb +14 -13
- data/lib/cogger/formatters/parsers/{specific.rb → key.rb} +16 -15
- data/lib/cogger/formatters/parsers/key_extractor.rb +1 -1
- data/lib/cogger/formatters/property.rb +45 -0
- data/lib/cogger/formatters/sanitizers/date_time.rb +16 -0
- data/lib/cogger/formatters/sanitizers/escape.rb +42 -0
- data/lib/cogger/formatters/sanitizers/filter.rb +13 -0
- data/lib/cogger/formatters/simple.rb +11 -6
- data/lib/cogger/formatters/transformers/color.rb +36 -0
- data/lib/cogger/formatters/transformers/emoji.rb +30 -0
- data/lib/cogger/formatters/transformers/key.rb +10 -0
- data/lib/cogger/hub.rb +3 -0
- data/lib/cogger/program.rb +1 -1
- data/lib/cogger/registry.rb +10 -1
- data/lib/cogger.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +12 -7
- metadata.gz.sig +0 -0
- data/lib/cogger/formatters/kit/colorizer.rb +0 -12
- data/lib/cogger/formatters/kit/sanitizer.rb +0 -18
- data/lib/cogger/formatters/processors/color.rb +0 -24
data/lib/cogger/registry.rb
CHANGED
@@ -26,6 +26,7 @@ module Cogger
|
|
26
26
|
)
|
27
27
|
.add_formatter(:emoji, Cogger::Formatters::Emoji)
|
28
28
|
.add_formatter(:json, Cogger::Formatters::JSON)
|
29
|
+
.add_formatter(:property, Cogger::Formatters::Property)
|
29
30
|
.add_formatter(:simple, Cogger::Formatters::Simple)
|
30
31
|
.add_formatter :rack,
|
31
32
|
Cogger::Formatters::Simple,
|
@@ -59,8 +60,10 @@ module Cogger
|
|
59
60
|
def filters = @filters ||= Set.new
|
60
61
|
|
61
62
|
def add_formatter key, formatter, template = nil
|
62
|
-
formatters[key.to_sym] = [formatter, template]
|
63
|
+
formatters[key.to_sym] = [formatter, template || formatter::TEMPLATE]
|
63
64
|
self
|
65
|
+
rescue NameError
|
66
|
+
raise NameError, "#{formatter}::TEMPLATE must be defined with a default template string."
|
64
67
|
end
|
65
68
|
|
66
69
|
def get_formatter key
|
@@ -69,6 +72,12 @@ module Cogger
|
|
69
72
|
|
70
73
|
def formatters = @formatters ||= {}
|
71
74
|
|
75
|
+
def templates
|
76
|
+
formatters.each.with_object({}) do |(key, (_formatter, template)), collection|
|
77
|
+
collection[key] = template
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
72
81
|
def color = @color ||= Tone.new
|
73
82
|
|
74
83
|
def defaults = {emojis:, aliases:, formatters:, filters:, color:}
|
data/lib/cogger.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-08-
|
38
|
+
date: 2024-08-28 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: core
|
@@ -108,20 +108,25 @@ files:
|
|
108
108
|
- lib/cogger.rb
|
109
109
|
- lib/cogger/configuration.rb
|
110
110
|
- lib/cogger/entry.rb
|
111
|
+
- lib/cogger/formatters/abstract.rb
|
111
112
|
- lib/cogger/formatters/color.rb
|
112
113
|
- lib/cogger/formatters/crash.rb
|
113
114
|
- lib/cogger/formatters/emoji.rb
|
114
115
|
- lib/cogger/formatters/json.rb
|
115
|
-
- lib/cogger/formatters/kit/colorizer.rb
|
116
|
-
- lib/cogger/formatters/kit/sanitizer.rb
|
117
116
|
- lib/cogger/formatters/parsers/abstract.rb
|
118
117
|
- lib/cogger/formatters/parsers/combined.rb
|
119
118
|
- lib/cogger/formatters/parsers/element.rb
|
120
119
|
- lib/cogger/formatters/parsers/emoji.rb
|
120
|
+
- lib/cogger/formatters/parsers/key.rb
|
121
121
|
- lib/cogger/formatters/parsers/key_extractor.rb
|
122
|
-
- lib/cogger/formatters/
|
123
|
-
- lib/cogger/formatters/
|
122
|
+
- lib/cogger/formatters/property.rb
|
123
|
+
- lib/cogger/formatters/sanitizers/date_time.rb
|
124
|
+
- lib/cogger/formatters/sanitizers/escape.rb
|
125
|
+
- lib/cogger/formatters/sanitizers/filter.rb
|
124
126
|
- lib/cogger/formatters/simple.rb
|
127
|
+
- lib/cogger/formatters/transformers/color.rb
|
128
|
+
- lib/cogger/formatters/transformers/emoji.rb
|
129
|
+
- lib/cogger/formatters/transformers/key.rb
|
125
130
|
- lib/cogger/hub.rb
|
126
131
|
- lib/cogger/level.rb
|
127
132
|
- lib/cogger/program.rb
|
@@ -158,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
163
|
- !ruby/object:Gem::Version
|
159
164
|
version: '0'
|
160
165
|
requirements: []
|
161
|
-
rubygems_version: 3.5.
|
166
|
+
rubygems_version: 3.5.18
|
162
167
|
signing_key:
|
163
168
|
specification_version: 4
|
164
169
|
summary: A customizable and feature rich logger.
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Cogger
|
4
|
-
module Formatters
|
5
|
-
module Kit
|
6
|
-
# Transform color based on dynamic (level) or standard color preference.
|
7
|
-
Colorizer = lambda do |value, attributes|
|
8
|
-
value == "dynamic" ? attributes[:level].downcase : value
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Cogger
|
4
|
-
module Formatters
|
5
|
-
module Kit
|
6
|
-
# Ensures log entry is filtered of sensitive data.
|
7
|
-
Sanitizer = lambda do |*input, filters: Cogger.filters|
|
8
|
-
*, entry = input
|
9
|
-
|
10
|
-
return Entry.for entry unless entry.is_a? Entry
|
11
|
-
|
12
|
-
payload = entry.payload
|
13
|
-
filters.each { |key| payload[key] = "[FILTERED]" if payload.key? key }
|
14
|
-
entry
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Cogger
|
4
|
-
module Formatters
|
5
|
-
module Processors
|
6
|
-
# Processes template with entry input using all template parsers.
|
7
|
-
class Color
|
8
|
-
def initialize parser: Parsers::Combined.new, sanitizer: Kit::Sanitizer
|
9
|
-
@parser = parser
|
10
|
-
@sanitizer = sanitizer
|
11
|
-
end
|
12
|
-
|
13
|
-
def call(template, *input)
|
14
|
-
attributes = sanitizer.call(*input).tagged
|
15
|
-
[parser.call(template, **attributes), attributes]
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
attr_reader :parser, :sanitizer
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|