trifle-logger 0.2.0 → 0.3.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/.github/workflows/ruby.yml +16 -17
- data/CHANGELOG.md +26 -0
- data/Gemfile.lock +1 -1
- data/lib/trifle/logger/configuration.rb +2 -2
- data/lib/trifle/logger/middleware/rack.rb +2 -1
- data/lib/trifle/logger/middleware/rails_controller.rb +1 -1
- data/lib/trifle/logger/middleware/sidekiq.rb +1 -1
- data/lib/trifle/logger/tracer/hash.rb +16 -7
- data/lib/trifle/logger/version.rb +1 -1
- data/trifle-logger.gemspec +9 -7
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ddb2f2292c349fdd346a0cf28889e4e2b6d0e6ae1afd81ca5a490724644147b
|
|
4
|
+
data.tar.gz: c2e6ad94f1fbc2f2b35e2620594030daed6d64db5b0319c68c4d4ed6be22bd33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fdc7dd705f38e2876fde06657c189e70abf4d4f5dffa6698862e0d9f2967592a1eb84c6660912da5ab609e1b055ec43ae1d477e928a6349f7295e7b571119a01
|
|
7
|
+
data.tar.gz: b1f8a8398a4b9b732a4b1378875866468e5115412cca3b0d93999cce7d00ac56fa36819fe2bc0987f5f29ea7945e4d0a88b95ccf0e976260ed7b4c21e9eea94a
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -9,29 +9,28 @@ name: Ruby
|
|
|
9
9
|
|
|
10
10
|
on:
|
|
11
11
|
push:
|
|
12
|
-
branches: [
|
|
12
|
+
branches: [main]
|
|
13
13
|
pull_request:
|
|
14
|
-
branches: [
|
|
14
|
+
branches: [main]
|
|
15
15
|
|
|
16
16
|
jobs:
|
|
17
17
|
test:
|
|
18
|
-
|
|
19
18
|
runs-on: ubuntu-latest
|
|
20
19
|
strategy:
|
|
21
20
|
matrix:
|
|
22
|
-
ruby-version: [
|
|
21
|
+
ruby-version: ["3.0"]
|
|
23
22
|
|
|
24
23
|
steps:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
- uses: actions/checkout@v2
|
|
25
|
+
- name: Set up Ruby
|
|
26
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
27
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
28
|
+
# uses: ruby/setup-ruby@v1
|
|
29
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
32
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
33
|
+
- name: Rspec
|
|
34
|
+
run: bundle exec rspec
|
|
35
|
+
- name: Rubocop
|
|
36
|
+
run: bundle exec rubocop
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [0.3.1] - 2022-01-11
|
|
4
|
+
|
|
5
|
+
- Feat: Allow reference to be passed into the Tracer directly
|
|
6
|
+
|
|
7
|
+
## [0.3.0] - 2022-01-11
|
|
8
|
+
|
|
9
|
+
- Feat: Rename tracer_klass to tracer_class and use it consistently through middlewares
|
|
10
|
+
|
|
11
|
+
## [0.2.2] - 2022-01-11
|
|
12
|
+
|
|
13
|
+
- Feat: Allow tracer to accept custom configuration
|
|
14
|
+
|
|
15
|
+
## [0.2.1] - 2021-06-11
|
|
16
|
+
|
|
17
|
+
- Chore: Update license
|
|
18
|
+
- Chore: Drop ruby 2.x
|
|
19
|
+
|
|
20
|
+
## [0.2.0] - 2021-06-1
|
|
21
|
+
|
|
22
|
+
- Feat: Add callbacks
|
|
23
|
+
|
|
24
|
+
## [0.1.x] - 2021-03-29
|
|
25
|
+
|
|
26
|
+
- Chore: Bunch of initial commits :)
|
data/Gemfile.lock
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
module Trifle
|
|
4
4
|
module Logger
|
|
5
5
|
class Configuration
|
|
6
|
-
attr_accessor :
|
|
6
|
+
attr_accessor :tracer_class, :callbacks, :bump_every
|
|
7
7
|
|
|
8
8
|
def initialize
|
|
9
|
-
@
|
|
9
|
+
@tracer_class = Trifle::Logger::Tracer::Hash
|
|
10
10
|
@callbacks = { liftoff: [], bump: [], wrapup: [] }
|
|
11
11
|
@bump_every = 15.seconds
|
|
12
12
|
end
|
|
@@ -9,7 +9,8 @@ module Trifle
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def call(env)
|
|
12
|
-
#
|
|
12
|
+
# TODO: set up key
|
|
13
|
+
# Trifle::Logger.tracer = Trifle::Logger.default.tracer_class.new
|
|
13
14
|
@status, @headers, @response = @app.call(env)
|
|
14
15
|
rescue => e # rubocop:disable Style/RescueStandardError
|
|
15
16
|
Trifle::Logger.tracer&.trace("Exception: #{e}", state: :error)
|
|
@@ -6,18 +6,27 @@ 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)
|
|
9
|
+
def initialize(key:, reference: nil, meta: nil, config: nil)
|
|
10
10
|
@key = key
|
|
11
11
|
@meta = meta
|
|
12
|
+
@config = config
|
|
13
|
+
set_defaults!
|
|
14
|
+
|
|
15
|
+
trace("Tracer has been initialized for #{key}")
|
|
16
|
+
@reference = reference || liftoff.first
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def set_defaults!
|
|
12
20
|
@data = []
|
|
13
21
|
@tags = []
|
|
14
22
|
@artifacts = []
|
|
15
23
|
@state = :running
|
|
16
24
|
@ignore = false
|
|
17
25
|
@result_prefix = '=> '
|
|
26
|
+
end
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
@
|
|
28
|
+
def config
|
|
29
|
+
@config || Trifle::Logger.default
|
|
21
30
|
end
|
|
22
31
|
|
|
23
32
|
def keys
|
|
@@ -99,19 +108,19 @@ module Trifle
|
|
|
99
108
|
|
|
100
109
|
def liftoff
|
|
101
110
|
@bumped_at = now
|
|
102
|
-
|
|
111
|
+
config.on_liftoff(self)
|
|
103
112
|
end
|
|
104
113
|
|
|
105
114
|
def bump
|
|
106
|
-
return unless @bumped_at && @bumped_at <= now -
|
|
115
|
+
return unless @bumped_at && @bumped_at <= now - config.bump_every
|
|
107
116
|
|
|
108
117
|
@bumped_at = now
|
|
109
|
-
|
|
118
|
+
config.on_bump(self)
|
|
110
119
|
end
|
|
111
120
|
|
|
112
121
|
def wrapup
|
|
113
122
|
success! if running?
|
|
114
|
-
|
|
123
|
+
config.on_wrapup(self)
|
|
115
124
|
end
|
|
116
125
|
end
|
|
117
126
|
end
|
data/trifle-logger.gemspec
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
require_relative 'lib/trifle/logger/version'
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
|
-
spec.name =
|
|
4
|
+
spec.name = 'trifle-logger'
|
|
5
5
|
spec.version = Trifle::Logger::VERSION
|
|
6
|
-
spec.authors = [
|
|
7
|
-
spec.email = [
|
|
6
|
+
spec.authors = ['Jozef Vaclavik']
|
|
7
|
+
spec.email = ['jozef@hey.com']
|
|
8
8
|
|
|
9
9
|
spec.summary = 'Simple logger backed by Hash'
|
|
10
10
|
spec.description = 'Trifle::Logger is a way too simple timeline logger '\
|
|
11
11
|
'that helps you track custom outputs.'
|
|
12
12
|
spec.homepage = 'https://trifle.io'
|
|
13
|
-
spec.
|
|
13
|
+
spec.licenses = ['MIT']
|
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6')
|
|
14
15
|
|
|
15
|
-
spec.metadata[
|
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
16
17
|
spec.metadata['source_code_uri'] = 'https://github.com/trifle-io/trifle-logger'
|
|
18
|
+
spec.metadata['changelog_uri'] = 'https://github.com/trifle-io/trifle-logger/blob/main/CHANGELOG.md'
|
|
17
19
|
|
|
18
20
|
# Specify which files should be added to the gem when it is released.
|
|
19
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
20
22
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
21
23
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
22
24
|
end
|
|
23
|
-
spec.bindir =
|
|
25
|
+
spec.bindir = 'exe'
|
|
24
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
|
-
spec.require_paths = [
|
|
27
|
+
spec.require_paths = ['lib']
|
|
26
28
|
|
|
27
29
|
spec.add_development_dependency('bundler', '~> 2.1')
|
|
28
30
|
spec.add_development_dependency('byebug', '>= 0')
|
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.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jozef Vaclavik
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -96,6 +96,7 @@ files:
|
|
|
96
96
|
- ".rubocop.yml"
|
|
97
97
|
- ".ruby-version"
|
|
98
98
|
- ".tool-versions"
|
|
99
|
+
- CHANGELOG.md
|
|
99
100
|
- Gemfile
|
|
100
101
|
- Gemfile.lock
|
|
101
102
|
- LICENSE
|
|
@@ -113,10 +114,12 @@ files:
|
|
|
113
114
|
- lib/trifle/logger/version.rb
|
|
114
115
|
- trifle-logger.gemspec
|
|
115
116
|
homepage: https://trifle.io
|
|
116
|
-
licenses:
|
|
117
|
+
licenses:
|
|
118
|
+
- MIT
|
|
117
119
|
metadata:
|
|
118
120
|
homepage_uri: https://trifle.io
|
|
119
121
|
source_code_uri: https://github.com/trifle-io/trifle-logger
|
|
122
|
+
changelog_uri: https://github.com/trifle-io/trifle-logger/blob/main/CHANGELOG.md
|
|
120
123
|
post_install_message:
|
|
121
124
|
rdoc_options: []
|
|
122
125
|
require_paths:
|