tlogger 0.26.2 → 0.26.3

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: 6f999c21a9d4ba07f90d307edfec87eda42b4b72ee8b40b1c03ebb5996f14562
4
- data.tar.gz: bd8a18877d7057263befec0cc93a939259bca1ab8c6084365d3bd055b732e489
3
+ metadata.gz: 4ec6d54a4a04d9944c59b9be2d2627d5d412d4e2b8d7ece85f4d4997f1950526
4
+ data.tar.gz: 4b573188c87f8cf8f9807e761e21653f1877da8b0094339caee6aac09a320ceb
5
5
  SHA512:
6
- metadata.gz: '092162f6c93adbfbff4cc3bbc1af619d10159be08960a23f352becbbb3038297ff5d67ed65a841d33b289bef62839ed7f1b270666be6e82f7d926c0ebcc868b8'
7
- data.tar.gz: 549e00b20bfa3ab36fcf01b68e54542d36df127bb84377c6c909d27f75b3bbec27e5446552bf37861071faa7d77829ac10a9bd24f793c2e2db7dc90a4a129e4f
6
+ metadata.gz: ff1e5a354429fa217521bd77993f2e4dc8d228aa9ca0ddfc5c8d7363c21cf21eab46eafde978a406dd5db490e0bc570a701128e44fc1309a358f10b25f373c29
7
+ data.tar.gz: 54246b70c1a15451430c7e60c67d79ce3d16a36425f5c7088adae3577660ceaae8d03276b94e63945ae9e72342120b6874634ab4c9e1b54c8b99dab8d66808a5
@@ -0,0 +1,4 @@
1
+ ---
2
+ tlogger:
3
+ - :version: 0.26.2
4
+ :timestamp: 1635927315.821185
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
 
6
6
  gem "rake", ">= 12.3.3"
7
7
  gem "minitest", "~> 5.0"
8
+ gem "rspec", "~> 3.0"
@@ -318,6 +318,34 @@ module Tlogger
318
318
  @include_caller = true
319
319
  end
320
320
 
321
+ # detect if the prompt should be to env or file
322
+ def self.init(out = STDOUT)
323
+ if is_dev?
324
+ Tlogger.new(out)
325
+ else
326
+ path = ENV["TLOGGER_FILE_PATH"]
327
+ if path.nil? or path.empty?
328
+ Tlogger.new(nil)
329
+ else
330
+ path = [path] if not path.is_a?(Array)
331
+ Tlogger.new(*path)
332
+ end
333
+ end
334
+ end
335
+
336
+ def self.set_dev_mode
337
+ ENV["TLOGGER_MODE"] = "dev"
338
+ end
339
+
340
+ def self.set_production_mode
341
+ ENV.delete("TLOGGER_MODE")
342
+ end
343
+
344
+ def self.is_dev?
345
+ ENV.keys.include?("TLOGGER_MODE") and ENV["TLOGGER_MODE"].downcase == "dev"
346
+ end
347
+
348
+
321
349
  private
322
350
  def format_message(key)
323
351
  # returning args array
@@ -1,3 +1,3 @@
1
1
  module Tlogger
2
- VERSION = "0.26.2"
2
+ VERSION = "0.26.3"
3
3
  end
data/lib/tlogger.rb CHANGED
@@ -3,6 +3,8 @@ require "tlogger/version"
3
3
  require_relative "tlogger/tlogger"
4
4
  require_relative "tlogger/logger_group"
5
5
 
6
+ require_relative 'tlogger_helper'
7
+
6
8
  #
7
9
  # :nodoc:
8
10
  #
@@ -15,51 +17,61 @@ module Tlogger
15
17
  ::Tlogger::Tlogger.new(*args,&block)
16
18
  end
17
19
 
18
- # detect if the prompt should be to env or file
19
- def init
20
- if is_dev?
21
- new(STDOUT)
22
- else
23
- c = output_channel
24
- new(*c[:path])
25
- end
20
+ def method_missing(mtd, *args, &block)
21
+ ::Tlogger::Tlogger.send(mtd, *args, &block)
26
22
  end
23
+ end
27
24
 
28
- def set_dev_mode
29
- ENV["TLOGGER_MODE"] = "dev"
30
- end
25
+ # # detect if the prompt should be to env or file
26
+ # def init
27
+ # if is_dev?
28
+ # new(STDOUT)
29
+ # else
30
+ # c = output_channel
31
+ # new(*c[:path])
32
+ # end
33
+ # end
31
34
 
32
- def set_production_mode
33
- ENV.delete("TLOGGER_MODE")
34
- end
35
+ # def set_dev_mode
36
+ # ENV["TLOGGER_MODE"] = "dev"
37
+ # end
35
38
 
36
- def is_dev?
37
- ENV.keys.include?("TLOGGER_MODE") and ENV["TLOGGER_MODE"].downcase == "dev"
38
- end
39
+ # def set_production_mode
40
+ # ENV.delete("TLOGGER_MODE")
41
+ # end
39
42
 
43
+ # def is_dev?
44
+ # ENV.keys.include?("TLOGGER_MODE") and ENV["TLOGGER_MODE"].downcase == "dev"
45
+ # end
40
46
 
41
- private
42
- def output_channel
43
- out = ENV["TLOGGER_OUT"]
44
- if not out.nil?
45
- case out
46
- when "file"
47
- path = ENV["TLOGGER_OUTPATH"]
48
- if path =~ /,/
49
- { mode: :file, path: path.split(",") }
50
- else
51
- { mode: :file, path: [path] }
52
- end
53
- else
54
- { mode: :file, path: [nil] }
55
- end
56
- else
57
- { mode: :stdio, path: [nil] }
58
- end
59
- end
60
- end # class self
47
+
48
+ # private
49
+ # def output_channel
50
+ # out = ENV["TLOGGER_OUT"]
51
+ # if not out.nil?
52
+ # case out
53
+ # when "file"
54
+ # path = ENV["TLOGGER_OUTPATH"]
55
+ # if path =~ /,/
56
+ # { mode: :file, path: path.split(",") }
57
+ # else
58
+ # { mode: :file, path: [path] }
59
+ # end
60
+ # else
61
+ # { mode: :file, path: [nil] }
62
+ # end
63
+ # else
64
+ # { mode: :stdio, path: [nil] }
65
+ # end
66
+ # end
67
+ #end # class self
61
68
 
62
69
 
63
70
  end
64
71
 
72
+ TloggerHelper = Tlogger::TloggerHelper
73
+ #v = $VERBOSE
74
+ #$VERBOSE = nil
75
+ #Tlogger = Tlogger::Tlogger
76
+ #$VERBOSE = v
65
77
 
@@ -1,17 +1,30 @@
1
1
 
2
- require_relative 'tlogger'
3
-
4
2
  module Tlogger
5
3
  module TloggerHelper
6
4
 
7
5
  module ClassMethods
8
- def tlogger(opts = { })
9
- defOpts = { tag: nil, dev_mode: false }.merge!(opts)
6
+ def init_tlogger(opts = { })
7
+ @opts = opts
8
+ end
10
9
 
10
+ def tlogger
11
11
  if @tlogger.nil?
12
- @tlogger = ::Tlogger.init
13
- ::Tlogger.set_dev_mode if defOps[:dev_mode] == true
14
- @tlogger.tag = tag if not (defOpts[:tag].nil? and defOps[:tag].empty?)
12
+ @opts = { } if @opts.nil?
13
+ defOpts = {
14
+ tag: nil,
15
+ dev_mode: false,
16
+ output: nil
17
+ }.merge!(@opts)
18
+
19
+ Tlogger.set_dev_mode if defOpts[:dev_mode] == true
20
+
21
+ if defOpts[:output].nil?
22
+ @tlogger = Tlogger.init
23
+ else
24
+ @tlogger = Tlogger.init(defOpts[:output])
25
+ end
26
+
27
+ @tlogger.tag = tag if not defOpts[:tag].nil? and not defOpts[:tag].empty?
15
28
  end
16
29
  @tlogger
17
30
  end
@@ -29,5 +42,4 @@ module Tlogger
29
42
  end
30
43
  end
31
44
 
32
- TloggerHelper = Tlogger::TloggerHelper
33
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tlogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.2
4
+ version: 0.26.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris
@@ -34,6 +34,7 @@ extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
36
  - ".gitignore"
37
+ - ".release_history.yml"
37
38
  - ".travis.yml"
38
39
  - CODE_OF_CONDUCT.md
39
40
  - Gemfile