trifle-logger 0.3.0 → 0.4.1
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
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +2 -2
- data/lib/trifle/logger/tracer/hash.rb +18 -15
- data/lib/trifle/logger/tracer/null.rb +1 -1
- data/lib/trifle/logger/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7329012794ba0eee7b210ecfa5f64db8e2af394b0af4830f6f01cdeec85bc78
|
4
|
+
data.tar.gz: c07503baf614956fe4d5c57164656c0c7d975655afe02cfaff5141dee8597963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 424f8243dce6ef5a223c95a68b8d146af6c9a4fe8604db11a85bf6154c5f37b049e9ac2ddbfa5bc15dc6a8432fbebecc97cd6f4b37a42cd4cad19d623f428f94
|
7
|
+
data.tar.gz: b4176e63114a973a0c5d39bd464b1b9332b9f3f16f74f9af34d8338a8a9afaf15370b7a656361dd3cdf97864f845d73e0bc0cd19e95f16202672187a326bb5c4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.4.1] - 2022-03-28
|
4
|
+
|
5
|
+
- Fix: There is no head in dump_message
|
6
|
+
- Fix: Null tracer cleanup
|
7
|
+
- Feat: allow to pop all data and artifacts
|
8
|
+
|
9
|
+
## [0.4.0] - 2022-03-28
|
10
|
+
|
11
|
+
- Feat: Hash tracer uses type to store text, head, raw, media.
|
12
|
+
|
13
|
+
## [0.3.1] - 2022-01-11
|
14
|
+
|
15
|
+
- Feat: Allow reference to be passed into the Tracer directly
|
16
|
+
|
3
17
|
## [0.3.0] - 2022-01-11
|
4
18
|
|
5
19
|
- Feat: Rename tracer_klass to tracer_class and use it consistently through middlewares
|
data/Gemfile.lock
CHANGED
@@ -6,25 +6,33 @@ module Trifle
|
|
6
6
|
class Hash
|
7
7
|
attr_accessor :key, :meta, :data, :tags, :artifacts, :state, :ignore, :reference
|
8
8
|
|
9
|
-
def initialize(key:, meta: nil, config: nil)
|
9
|
+
def initialize(key:, reference: nil, meta: nil, config: nil)
|
10
10
|
@key = key
|
11
11
|
@meta = meta
|
12
12
|
@config = config
|
13
13
|
set_defaults!
|
14
14
|
|
15
15
|
trace("Tracer has been initialized for #{key}")
|
16
|
-
@reference = liftoff.first
|
16
|
+
@reference = reference || liftoff.first
|
17
17
|
end
|
18
18
|
|
19
19
|
def set_defaults!
|
20
|
-
@data = []
|
21
20
|
@tags = []
|
21
|
+
@data = []
|
22
22
|
@artifacts = []
|
23
23
|
@state = :running
|
24
24
|
@ignore = false
|
25
25
|
@result_prefix = '=> '
|
26
26
|
end
|
27
27
|
|
28
|
+
def pop_all_data
|
29
|
+
@data.pop(@data.count)
|
30
|
+
end
|
31
|
+
|
32
|
+
def pop_all_artifacts
|
33
|
+
@artifacts.pop(@artifacts.count)
|
34
|
+
end
|
35
|
+
|
28
36
|
def config
|
29
37
|
@config || Trifle::Logger.default
|
30
38
|
end
|
@@ -36,29 +44,27 @@ module Trifle
|
|
36
44
|
|
37
45
|
def trace(message, state: :success, head: false) # rubocop:disable Metrics/MethodLength
|
38
46
|
result = yield if block_given?
|
39
|
-
rescue => e
|
47
|
+
rescue StandardError => e
|
40
48
|
raise e
|
41
49
|
ensure
|
42
50
|
dump_message(
|
43
51
|
message,
|
44
|
-
|
52
|
+
type: head ? :head : :text,
|
53
|
+
state: e ? :error : state
|
45
54
|
)
|
46
55
|
dump_result(result) if block_given?
|
47
56
|
bump
|
48
57
|
result
|
49
58
|
end
|
50
59
|
|
51
|
-
def dump_message(message,
|
52
|
-
@data << {
|
53
|
-
at: now, message: message,
|
54
|
-
state: state, head: head, meta: false, media: false
|
55
|
-
}
|
60
|
+
def dump_message(message, type:, state:)
|
61
|
+
@data << { at: now, message: message, state: state, type: type }
|
56
62
|
end
|
57
63
|
|
58
64
|
def dump_result(result)
|
59
65
|
@data << {
|
60
66
|
at: now, message: "#{@result_prefix}#{result.inspect}",
|
61
|
-
state: :success,
|
67
|
+
state: :success, type: :raw
|
62
68
|
}
|
63
69
|
end
|
64
70
|
|
@@ -73,10 +79,7 @@ module Trifle
|
|
73
79
|
end
|
74
80
|
|
75
81
|
def artifact(name, path)
|
76
|
-
@data << {
|
77
|
-
at: now, message: name,
|
78
|
-
state: :success, head: false, meta: false, media: true
|
79
|
-
}
|
82
|
+
@data << { at: now, message: name, state: :success, type: :media, size: File.size(path) }
|
80
83
|
@artifacts << path
|
81
84
|
bump
|
82
85
|
path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trifle-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jozef Vaclavik
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -120,7 +120,7 @@ metadata:
|
|
120
120
|
homepage_uri: https://trifle.io
|
121
121
|
source_code_uri: https://github.com/trifle-io/trifle-logger
|
122
122
|
changelog_uri: https://github.com/trifle-io/trifle-logger/blob/main/CHANGELOG.md
|
123
|
-
post_install_message:
|
123
|
+
post_install_message:
|
124
124
|
rdoc_options: []
|
125
125
|
require_paths:
|
126
126
|
- lib
|
@@ -135,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.2.
|
139
|
-
signing_key:
|
138
|
+
rubygems_version: 3.2.9
|
139
|
+
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Simple logger backed by Hash
|
142
142
|
test_files: []
|