trifle-logger 0.0.2 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec21c65044918d6dd00c78de8fccadc712ae8347e179c4b210db89b01e0796e7
4
- data.tar.gz: 043b612ac2dcf1fb49ac2e189b48e6633d8a3c0f64fd33f07115195431003e00
3
+ metadata.gz: 7d2deabd47fce1cb9b29ab0eeaad61aa482e437c3c38b6c0387a96a37a3e9287
4
+ data.tar.gz: 9e7e5439cabc64584f885145f888d9f021633ce41e0b42c17a8d83f345a7236a
5
5
  SHA512:
6
- metadata.gz: e6869a6b6a7ba8c7d9b4d8d00b53093eb076accc3b02d3998c0911dc69f5613ba793ec21381feeea097be10a15a4990ccc7356ca0852bc2c52aadc18e5a3252e
7
- data.tar.gz: 9fa389f4e4f4693c6fab7faba0acf65f328a2bd26c159371fa2433f0049b45ab2bc40bab17e283b9195adf540ae5d2b4e0a08692da21b81b3b95c7e7ccd26513
6
+ metadata.gz: e7d722da4c38ba4cd06945969eb493fdcb040d80b095e895512d1ab3fe31eaefa26678bd4cd03eb5485a2d3df3f6b76536ae64a69e5c539910c4095feb56093f
7
+ data.tar.gz: bfdcb7461e9b069846e5f9abd39ed2e4c8368aa598fdec48e23640f5647e7e7ecd1a9ed92d3d28ad570b7bd1180d023dd343c0605ba7c6872e9977bdc084fd21
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trifle-logger (0.0.2)
4
+ trifle-logger (0.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -31,8 +31,25 @@ Or install it yourself as:
31
31
 
32
32
  ## Usage
33
33
 
34
- TODO: Write usage instructions here
34
+ It saves you from reading through your standard logger
35
+
36
+ ```ruby
37
+ Trifle::Logger.trace('This is important output')
38
+ now = Trifle::Logger.trace('And it\'s important to know it happened at') do
39
+ Time.now
40
+ end
41
+ ```
42
+
43
+ To being able to say what happened on 25th January 2021.
44
+
45
+ ```ruby
46
+ [
47
+ {at: 2021-01-25 00:00:00 +0100, message: 'This is important output', state: :success, head: false, meta: false}
48
+ {at: 2021-01-25 00:00:00 +0100, message: 'And it\'s important to know it happened ', state: :success, head: false, meta: false}
49
+ {at: 2021-01-25 00:00:00 +0100, message: '=> 2021-01-25 00:00:00 +0100', state: :success, head: false, meta: true}
50
+ ]
51
+ ```
35
52
 
36
53
  ## Contributing
37
54
 
38
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/trifle-logger.
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/trifle-io/trifle-logger.
data/lib/trifle/logger.rb CHANGED
@@ -45,6 +45,12 @@ module Trifle
45
45
  tracer.tag(tag)
46
46
  end
47
47
 
48
+ def self.artifact(name, path)
49
+ return unless tracer
50
+
51
+ tracer.artifact(name, path)
52
+ end
53
+
48
54
  def self.fail!
49
55
  return unless tracer
50
56
 
@@ -4,13 +4,14 @@ module Trifle
4
4
  module Logger
5
5
  module Tracer
6
6
  class Hash
7
- attr_accessor :key, :meta, :data, :tags, :state
7
+ attr_accessor :key, :meta, :data, :tags, :artifacts, :state
8
8
 
9
9
  def initialize(key:, meta: nil)
10
10
  @key = key
11
11
  @meta = meta
12
12
  @data = []
13
13
  @tags = []
14
+ @artifacts = []
14
15
  @state = :success
15
16
  @result_prefix = '=> '
16
17
 
@@ -57,6 +58,14 @@ module Trifle
57
58
  @tags << tag
58
59
  end
59
60
 
61
+ def artifact(name, path)
62
+ @data << {
63
+ at: now, message: "Artifact: #{name}",
64
+ state: :success, head: false, meta: true
65
+ }
66
+ @artifacts << path
67
+ end
68
+
60
69
  def fail!
61
70
  @state = :error
62
71
  end
@@ -8,7 +8,9 @@ module Trifle
8
8
  yield if block_given?
9
9
  end
10
10
 
11
- def tag(_resource); end
11
+ def tag(_tag); end
12
+
13
+ def artifact(_name, _path); end
12
14
 
13
15
  def fail!; end
14
16
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Trifle
4
4
  module Logger
5
- VERSION = '0.0.2'
5
+ VERSION = '0.1.0'
6
6
  end
7
7
  end
@@ -6,11 +6,10 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Jozef Vaclavik"]
7
7
  spec.email = ["jozef@hey.com"]
8
8
 
9
- spec.summary = 'Simple logger backed by Redis, Postgres, MongoDB, '\
10
- 'or whatever'
9
+ spec.summary = 'Simple logger backed by Hash'
11
10
  spec.description = 'Trifle::Logger is a way too simple timeline logger '\
12
11
  'that helps you track custom outputs.'
13
- spec.homepage = "https://trifle.io"
12
+ spec.homepage = 'https://trifle.io'
14
13
  spec.required_ruby_version = Gem::Requirement.new(">= 2.6")
15
14
 
16
15
  spec.metadata["homepage_uri"] = spec.homepage
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.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jozef Vaclavik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-08 00:00:00.000000000 Z
11
+ date: 2021-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -135,5 +135,5 @@ requirements: []
135
135
  rubygems_version: 3.2.3
136
136
  signing_key:
137
137
  specification_version: 4
138
- summary: Simple logger backed by Redis, Postgres, MongoDB, or whatever
138
+ summary: Simple logger backed by Hash
139
139
  test_files: []