trifle-logger 0.0.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 +7 -0
- data/.github/workflows/ruby.yml +37 -0
- data/.gitignore +12 -0
- data/.gitpod.yml +18 -0
- data/.gitpod/Dockerfile +1 -0
- data/.rspec +3 -0
- data/.rubocop.yml +15 -0
- data/.ruby-version +1 -0
- data/.tool-versions +1 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +59 -0
- data/LICENSE +21 -0
- data/README.md +38 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/trifle/logger.rb +52 -0
- data/lib/trifle/logger/configuration.rb +26 -0
- data/lib/trifle/logger/middleware/rack.rb +25 -0
- data/lib/trifle/logger/middleware/rails_controller.rb +43 -0
- data/lib/trifle/logger/middleware/sidekiq.rb +28 -0
- data/lib/trifle/logger/tracer/hash.rb +74 -0
- data/lib/trifle/logger/tracer/null.rb +19 -0
- data/lib/trifle/logger/version.rb +7 -0
- data/trifle-logger.gemspec +33 -0
- metadata +139 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f398296489f07bf076bf0bf6775e57156c0cc6b17afd4eb27df7f5d37fc1b89d
|
|
4
|
+
data.tar.gz: b2a9f30e51212af4e1d659d754e034f9d1adee1c13a8e7f716dea0c906aa3e1d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: bc98595231311b0a4ef4eaddbbe7ff7440460415b9d9d56e528b39a8b677c1719dc801483f9bfac7add6a945fe1dbca81bed68ddb456233f22c031e7b9771604
|
|
7
|
+
data.tar.gz: 2f283dd02cb0cd62f403a7e9ae2f1349f644cb714014da9bcdc20084fe249775dd993c85a0535a771afcb011d6f62017c9ed57502bdc2aba9f58f1f68a8e9c56
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
+
|
|
8
|
+
name: Ruby
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ main ]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [ main ]
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
strategy:
|
|
21
|
+
matrix:
|
|
22
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v2
|
|
26
|
+
- name: Set up Ruby
|
|
27
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
28
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
29
|
+
# uses: ruby/setup-ruby@v1
|
|
30
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
|
31
|
+
with:
|
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
34
|
+
- name: Rspec
|
|
35
|
+
run: bundle exec rspec
|
|
36
|
+
- name: Rubocop
|
|
37
|
+
run: bundle exec rubocop
|
data/.gitignore
ADDED
data/.gitpod.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
image:
|
|
2
|
+
file: .gitpod/Dockerfile
|
|
3
|
+
tasks:
|
|
4
|
+
- init: bundle install
|
|
5
|
+
command: ./bin/console
|
|
6
|
+
- command: redis-server
|
|
7
|
+
github:
|
|
8
|
+
prebuilds:
|
|
9
|
+
# enable for the master/default branch (defaults to true)
|
|
10
|
+
master: true
|
|
11
|
+
# enable for all branches in this repo (defaults to false)
|
|
12
|
+
branches: false
|
|
13
|
+
# enable for pull requests coming from this repo (defaults to true)
|
|
14
|
+
pullRequests: true
|
|
15
|
+
# add a check to pull requests (defaults to true)
|
|
16
|
+
addCheck: true
|
|
17
|
+
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
|
|
18
|
+
addComment: false
|
data/.gitpod/Dockerfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
FROM trifle/gitpod:0.1.0
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-3.0.0
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 3.0.0
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
trifle-logger (0.0.1)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
ast (2.4.2)
|
|
10
|
+
byebug (11.1.3)
|
|
11
|
+
diff-lcs (1.4.4)
|
|
12
|
+
parallel (1.20.1)
|
|
13
|
+
parser (3.0.0.0)
|
|
14
|
+
ast (~> 2.4.1)
|
|
15
|
+
rainbow (3.0.0)
|
|
16
|
+
rake (12.3.3)
|
|
17
|
+
regexp_parser (2.0.3)
|
|
18
|
+
rexml (3.2.4)
|
|
19
|
+
rspec (3.10.0)
|
|
20
|
+
rspec-core (~> 3.10.0)
|
|
21
|
+
rspec-expectations (~> 3.10.0)
|
|
22
|
+
rspec-mocks (~> 3.10.0)
|
|
23
|
+
rspec-core (3.10.1)
|
|
24
|
+
rspec-support (~> 3.10.0)
|
|
25
|
+
rspec-expectations (3.10.1)
|
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
27
|
+
rspec-support (~> 3.10.0)
|
|
28
|
+
rspec-mocks (3.10.2)
|
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
30
|
+
rspec-support (~> 3.10.0)
|
|
31
|
+
rspec-support (3.10.2)
|
|
32
|
+
rubocop (1.0.0)
|
|
33
|
+
parallel (~> 1.10)
|
|
34
|
+
parser (>= 2.7.1.5)
|
|
35
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
36
|
+
regexp_parser (>= 1.8)
|
|
37
|
+
rexml
|
|
38
|
+
rubocop-ast (>= 0.6.0)
|
|
39
|
+
ruby-progressbar (~> 1.7)
|
|
40
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
41
|
+
rubocop-ast (1.4.1)
|
|
42
|
+
parser (>= 2.7.1.5)
|
|
43
|
+
ruby-progressbar (1.11.0)
|
|
44
|
+
unicode-display_width (1.7.0)
|
|
45
|
+
|
|
46
|
+
PLATFORMS
|
|
47
|
+
ruby
|
|
48
|
+
x86_64-darwin-20
|
|
49
|
+
|
|
50
|
+
DEPENDENCIES
|
|
51
|
+
bundler (~> 2.1)
|
|
52
|
+
byebug
|
|
53
|
+
rake (~> 12.0)
|
|
54
|
+
rspec (~> 3.0)
|
|
55
|
+
rubocop (= 1.0.0)
|
|
56
|
+
trifle-logger!
|
|
57
|
+
|
|
58
|
+
BUNDLED WITH
|
|
59
|
+
2.2.3
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Jozef Vaclavik
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Trifle::Logger
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/rb/trifle-logger)
|
|
4
|
+

|
|
5
|
+
[](https://gitpod.io/#https://github.com/trifle-io/trifle-logger)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Simple logger backed by Redis, Postgres, MongoDB, or whatever.
|
|
9
|
+
|
|
10
|
+
`Trifle::Logger` is a way too simple timeline logger that helps you track custom outputs. Ideal for any code from blackbox category (aka background-job-that-talks-to-API-and-works-every-time-when-you-run-it-manually-but-never-when-in-production type of jobs)
|
|
11
|
+
|
|
12
|
+
## Documentation
|
|
13
|
+
|
|
14
|
+
You can find guides and documentation at https://trifle.io/docs/logger
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Add this line to your application's Gemfile:
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
gem 'trifle-logger'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
And then execute:
|
|
25
|
+
|
|
26
|
+
$ bundle install
|
|
27
|
+
|
|
28
|
+
Or install it yourself as:
|
|
29
|
+
|
|
30
|
+
$ gem install trifle-logger
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
TODO: Write usage instructions here
|
|
35
|
+
|
|
36
|
+
## Contributing
|
|
37
|
+
|
|
38
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/trifle-logger.
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "trifle/logger"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'trifle/logger/configuration'
|
|
4
|
+
require 'trifle/logger/tracer/hash'
|
|
5
|
+
require 'trifle/logger/tracer/null'
|
|
6
|
+
require 'trifle/logger/middleware/rack'
|
|
7
|
+
require 'trifle/logger/middleware/rails_controller'
|
|
8
|
+
require 'trifle/logger/middleware/sidekiq'
|
|
9
|
+
require 'trifle/logger/version'
|
|
10
|
+
|
|
11
|
+
module Trifle
|
|
12
|
+
module Logger
|
|
13
|
+
class Error < StandardError; end
|
|
14
|
+
# Your code goes here...
|
|
15
|
+
|
|
16
|
+
def self.default
|
|
17
|
+
@default ||= Configuration.new
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.configure
|
|
21
|
+
yield(default)
|
|
22
|
+
|
|
23
|
+
default
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.tracer=(tracer)
|
|
27
|
+
Thread.current[:trifle_tracer] = tracer
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.tracer
|
|
31
|
+
Thread.current[:trifle_tracer]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.trace(*args, **keywords, &block)
|
|
35
|
+
return unless tracer
|
|
36
|
+
|
|
37
|
+
tracer.trace(*args, **keywords, &block)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.tag(tag)
|
|
41
|
+
return unless tracer
|
|
42
|
+
|
|
43
|
+
tracer.tag(tag)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.fail!
|
|
47
|
+
return unless tracer
|
|
48
|
+
|
|
49
|
+
tracer.fail!
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Trifle
|
|
4
|
+
module Logger
|
|
5
|
+
class Configuration
|
|
6
|
+
attr_accessor :tracer_klass, :callbacks
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@tracer_klass = Trifle::Logger::Tracer::Hash
|
|
10
|
+
@callbacks = {
|
|
11
|
+
wrapup: []
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def on_wrapup(tracer)
|
|
16
|
+
@callbacks.fetch(:wrapup, []).each do |c|
|
|
17
|
+
c.call(tracer)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def on(event, &block)
|
|
22
|
+
@callbacks[event] << block
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Trifle
|
|
4
|
+
module Logger
|
|
5
|
+
module Middleware
|
|
6
|
+
class Rack
|
|
7
|
+
def initialize(app)
|
|
8
|
+
@app = app
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def call(env)
|
|
12
|
+
# Trifle::Logger.tracer = Trifle::Logger::Tracer::Hash.new
|
|
13
|
+
@status, @headers, @response = @app.call(env)
|
|
14
|
+
rescue => e # rubocop:disable Style/RescueStandardError
|
|
15
|
+
Trifle::Logger.tracer&.trace("Exception: #{e}", state: :error)
|
|
16
|
+
Trifle::Logger.tracer&.fail!
|
|
17
|
+
raise e
|
|
18
|
+
ensure
|
|
19
|
+
Trifle::Logger.tracer&.wrapup
|
|
20
|
+
[@status, @headers, @response]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Trifle
|
|
4
|
+
module Logger
|
|
5
|
+
module Middleware
|
|
6
|
+
module RailsController
|
|
7
|
+
def self.included(base)
|
|
8
|
+
base.extend ClassMethods
|
|
9
|
+
base.include InstanceMethods
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module ClassMethods
|
|
13
|
+
def with_trifle_logger(options = {})
|
|
14
|
+
around_action :with_trifle_logger, options
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
module InstanceMethods
|
|
19
|
+
def with_trifle_logger
|
|
20
|
+
Trifle::Logger.tracer = Trifle::Logger::Tracer::Hash.new(
|
|
21
|
+
key: trace_key, meta: trace_meta
|
|
22
|
+
)
|
|
23
|
+
yield
|
|
24
|
+
rescue => e # rubocop:disable Style/RescueStandardError
|
|
25
|
+
Trifle::Logger.tracer.trace("Exception: #{e}", state: :error)
|
|
26
|
+
Trifle::Logger.tracer.fail!
|
|
27
|
+
raise e
|
|
28
|
+
ensure
|
|
29
|
+
Trifle::Logger.tracer.wrapup
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def trace_key
|
|
33
|
+
"#{params[:controller]}/#{params[:action]}"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def trace_meta
|
|
37
|
+
[params[:id]].compact
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Trifle
|
|
4
|
+
module Logger
|
|
5
|
+
module Middleware
|
|
6
|
+
class Sidekiq
|
|
7
|
+
def call(_worker, job, _queue)
|
|
8
|
+
Trifle::Logger.tracer = tracer_for(job: job)
|
|
9
|
+
yield
|
|
10
|
+
rescue => e # rubocop:disable Style/RescueStandardError
|
|
11
|
+
Trifle::Logger.tracer&.trace("Exception: #{e}", state: :error)
|
|
12
|
+
Trifle::Logger.tracer&.fail!
|
|
13
|
+
raise e
|
|
14
|
+
ensure
|
|
15
|
+
Trifle::Logger.tracer&.wrapup
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def tracer_for(job:)
|
|
19
|
+
return nil unless job['logger_key']
|
|
20
|
+
|
|
21
|
+
Trifle::Logger.default.tracer_klass.new(
|
|
22
|
+
key: job['logger_key'], meta: job['args']
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Trifle
|
|
4
|
+
module Logger
|
|
5
|
+
module Tracer
|
|
6
|
+
class Hash
|
|
7
|
+
attr_accessor :key, :meta, :data, :tags, :state
|
|
8
|
+
|
|
9
|
+
def initialize(key:, meta: nil)
|
|
10
|
+
@key = key
|
|
11
|
+
@meta = meta
|
|
12
|
+
@data = []
|
|
13
|
+
@tags = []
|
|
14
|
+
@state = :success
|
|
15
|
+
@result_prefix = '=> '
|
|
16
|
+
|
|
17
|
+
trace("Trifle::Trace has been initialized for #{key}")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def keys
|
|
21
|
+
parts = key.split('/')
|
|
22
|
+
parts.count.times.map { |i| parts[0..i].join('/') }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def trace(message, state: :success, head: false)
|
|
26
|
+
result = yield if block_given?
|
|
27
|
+
rescue => e # rubocop:disable Style/RescueStandardError
|
|
28
|
+
raise e
|
|
29
|
+
ensure
|
|
30
|
+
dump_message(
|
|
31
|
+
message,
|
|
32
|
+
head: head, state: block_given? && result.nil? || e ? :error : state
|
|
33
|
+
)
|
|
34
|
+
dump_result(result) if block_given?
|
|
35
|
+
result
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def dump_message(message, head:, state:)
|
|
39
|
+
@data << {
|
|
40
|
+
at: now, message: message,
|
|
41
|
+
state: state, head: head, meta: false
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def dump_result(result)
|
|
46
|
+
@data << {
|
|
47
|
+
at: now, message: "#{@result_prefix}#{result.inspect}",
|
|
48
|
+
state: :success, head: false, meta: true
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def now
|
|
53
|
+
Time.now.to_i
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def tag(tag)
|
|
57
|
+
@tags << tag
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def fail!
|
|
61
|
+
@state = :error
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def success?
|
|
65
|
+
@state == :success
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def wrapup
|
|
69
|
+
Trifle::Logger.default.on_wrapup(self)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Trifle
|
|
4
|
+
module Logger
|
|
5
|
+
module Tracer
|
|
6
|
+
class Null
|
|
7
|
+
def log(_message, **_keywords)
|
|
8
|
+
yield if block_given?
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def tag(_resource); end
|
|
12
|
+
|
|
13
|
+
def fail!; end
|
|
14
|
+
|
|
15
|
+
def wrapup; end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require_relative 'lib/trifle/logger/version'
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = "trifle-logger"
|
|
5
|
+
spec.version = Trifle::Logger::VERSION
|
|
6
|
+
spec.authors = ["Jozef Vaclavik"]
|
|
7
|
+
spec.email = ["jozef@hey.com"]
|
|
8
|
+
|
|
9
|
+
spec.summary = 'Simple logger backed by Redis, Postgres, MongoDB, '\
|
|
10
|
+
'or whatever'
|
|
11
|
+
spec.description = 'Trifle::Logger is a way too simple timeline logger '\
|
|
12
|
+
'that helps you track custom outputs.'
|
|
13
|
+
spec.homepage = "https://trifle.io"
|
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6")
|
|
15
|
+
|
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
17
|
+
spec.metadata['source_code_uri'] = 'https://github.com/trifle-io/trifle-logger'
|
|
18
|
+
|
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
21
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
23
|
+
end
|
|
24
|
+
spec.bindir = "exe"
|
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
26
|
+
spec.require_paths = ["lib"]
|
|
27
|
+
|
|
28
|
+
spec.add_development_dependency('bundler', '~> 2.1')
|
|
29
|
+
spec.add_development_dependency('byebug', '>= 0')
|
|
30
|
+
spec.add_development_dependency('rake', '~> 13.0')
|
|
31
|
+
spec.add_development_dependency('rspec', '~> 3.2')
|
|
32
|
+
spec.add_development_dependency('rubocop', '1.0.0')
|
|
33
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: trifle-logger
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jozef Vaclavik
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-02-08 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.1'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.1'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: byebug
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '13.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '13.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.2'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.2'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rubocop
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - '='
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 1.0.0
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - '='
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 1.0.0
|
|
83
|
+
description: Trifle::Logger is a way too simple timeline logger that helps you track
|
|
84
|
+
custom outputs.
|
|
85
|
+
email:
|
|
86
|
+
- jozef@hey.com
|
|
87
|
+
executables: []
|
|
88
|
+
extensions: []
|
|
89
|
+
extra_rdoc_files: []
|
|
90
|
+
files:
|
|
91
|
+
- ".github/workflows/ruby.yml"
|
|
92
|
+
- ".gitignore"
|
|
93
|
+
- ".gitpod.yml"
|
|
94
|
+
- ".gitpod/Dockerfile"
|
|
95
|
+
- ".rspec"
|
|
96
|
+
- ".rubocop.yml"
|
|
97
|
+
- ".ruby-version"
|
|
98
|
+
- ".tool-versions"
|
|
99
|
+
- Gemfile
|
|
100
|
+
- Gemfile.lock
|
|
101
|
+
- LICENSE
|
|
102
|
+
- README.md
|
|
103
|
+
- Rakefile
|
|
104
|
+
- bin/console
|
|
105
|
+
- bin/setup
|
|
106
|
+
- lib/trifle/logger.rb
|
|
107
|
+
- lib/trifle/logger/configuration.rb
|
|
108
|
+
- lib/trifle/logger/middleware/rack.rb
|
|
109
|
+
- lib/trifle/logger/middleware/rails_controller.rb
|
|
110
|
+
- lib/trifle/logger/middleware/sidekiq.rb
|
|
111
|
+
- lib/trifle/logger/tracer/hash.rb
|
|
112
|
+
- lib/trifle/logger/tracer/null.rb
|
|
113
|
+
- lib/trifle/logger/version.rb
|
|
114
|
+
- trifle-logger.gemspec
|
|
115
|
+
homepage: https://trifle.io
|
|
116
|
+
licenses: []
|
|
117
|
+
metadata:
|
|
118
|
+
homepage_uri: https://trifle.io
|
|
119
|
+
source_code_uri: https://github.com/trifle-io/trifle-logger
|
|
120
|
+
post_install_message:
|
|
121
|
+
rdoc_options: []
|
|
122
|
+
require_paths:
|
|
123
|
+
- lib
|
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
|
+
requirements:
|
|
126
|
+
- - ">="
|
|
127
|
+
- !ruby/object:Gem::Version
|
|
128
|
+
version: '2.6'
|
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - ">="
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '0'
|
|
134
|
+
requirements: []
|
|
135
|
+
rubygems_version: 3.2.3
|
|
136
|
+
signing_key:
|
|
137
|
+
specification_version: 4
|
|
138
|
+
summary: Simple logger backed by Redis, Postgres, MongoDB, or whatever
|
|
139
|
+
test_files: []
|