tlogger 0.25.1 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4232ba1eb83e3cd042ea70c67272fb9598b74d0b295494a9ee540b3c6491c92
4
- data.tar.gz: e6c805f3229fe09d4a2b1bf1b9d18e1a0bcd243ae2839eaa096664dba2a3bcbb
3
+ metadata.gz: 456f792986f50cb09f12b7bff8e062cb79cb705700e0a8f909f265d5a5f55df2
4
+ data.tar.gz: 16434a962194549c73ed7cc27b2b5a848b02c687716f31f59551a9b9e4202b4c
5
5
  SHA512:
6
- metadata.gz: 5860e1862e58902dc358529e35891900e377fc0055bd8ed9fc9dfe653c49d2f719f8e507705e9372b462678979595c00bd607298cdfe296b6d3d2d14b63ba268
7
- data.tar.gz: 3dc82d00fb68f8baf5d9d4115be52c8bca5b841768178fb036889873020b9ea559acf3b5da076692872865fb963eee39a9c72351eb9df975e45bc8d51281bedb
6
+ metadata.gz: 7541a13f50860790deb9841cc265c25e37982cb1981de92a4d92fd4fee27473e21aac95a589b7b1f53a6d2afa0dbabf78f53dd499620798d4a1f6d61f222492a
7
+ data.tar.gz: 055e68a34f282a659d8e7699a52f0206a9149f60bb0b0ed8367f14fb466a7c9c35126a129807cf459b55f315c2c488dfaa4c0921a6505292f333b705b571409b
@@ -1,3 +1,3 @@
1
1
  module Tlogger
2
- VERSION = "0.25.1"
2
+ VERSION = "0.26.0"
3
3
  end
data/lib/tlogger.rb CHANGED
@@ -17,6 +17,7 @@ module Tlogger
17
17
 
18
18
  # detect if the prompt should be to env or file
19
19
  def init
20
+ p is_dev?
20
21
  if is_dev?
21
22
  new(STDOUT)
22
23
  else
@@ -37,6 +38,7 @@ module Tlogger
37
38
  ENV.keys.include?("TLOGGER_MODE") and ENV["TLOGGER_MODE"].downcase == "dev"
38
39
  end
39
40
 
41
+
40
42
  private
41
43
  def output_channel
42
44
  out = ENV["TLOGGER_OUT"]
@@ -58,5 +60,7 @@ module Tlogger
58
60
  end
59
61
  end # class self
60
62
 
63
+
61
64
  end
62
65
 
66
+
@@ -0,0 +1,35 @@
1
+
2
+ require_relative 'tlogger'
3
+
4
+ module Tlogger
5
+ module TloggerHelper
6
+
7
+ module TloggerClassMethods
8
+ def tlogger(tag = nil)
9
+ if @tlogger.nil?
10
+ @tlogger = ::Tlogger.init
11
+ @tlogger.tag = tag if not (tag.nil? and tag.empty?)
12
+ end
13
+ @tlogger
14
+ end
15
+
16
+ def default_logger(tag, dev_mode = false)
17
+ ::Tlogger.set_dev_mode if dev_mode
18
+ tlogger(tag)
19
+ end
20
+ end
21
+
22
+ def self.included(klass)
23
+ klass.extend(TloggerClassMethods)
24
+ end
25
+
26
+ self.extend(TloggerClassMethods)
27
+
28
+ if not respond_to?(:logger)
29
+ def logger
30
+ self.class.tlogger
31
+ end
32
+ end
33
+
34
+ end
35
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tlogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.1
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-09 00:00:00.000000000 Z
11
+ date: 2021-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devops_helper
@@ -45,6 +45,7 @@ files:
45
45
  - lib/tlogger/logger_group.rb
46
46
  - lib/tlogger/tlogger.rb
47
47
  - lib/tlogger/version.rb
48
+ - lib/tlogger_helper.rb
48
49
  - samples/basic.rb
49
50
  - samples/group.rb
50
51
  - tlogger.gemspec
@@ -53,7 +54,7 @@ licenses:
53
54
  - MIT
54
55
  metadata:
55
56
  homepage_uri: https://github.com/chrisliaw/tlogger
56
- post_install_message:
57
+ post_install_message:
57
58
  rdoc_options: []
58
59
  require_paths:
59
60
  - lib
@@ -69,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
70
  version: '0'
70
71
  requirements: []
71
72
  rubygems_version: 3.2.22
72
- signing_key:
73
+ signing_key:
73
74
  specification_version: 4
74
75
  summary: Logger that added contextual information to the log messages
75
76
  test_files: []