tlogger 0.25.1 → 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: b4232ba1eb83e3cd042ea70c67272fb9598b74d0b295494a9ee540b3c6491c92
4
- data.tar.gz: e6c805f3229fe09d4a2b1bf1b9d18e1a0bcd243ae2839eaa096664dba2a3bcbb
3
+ metadata.gz: 4ec6d54a4a04d9944c59b9be2d2627d5d412d4e2b8d7ece85f4d4997f1950526
4
+ data.tar.gz: 4b573188c87f8cf8f9807e761e21653f1877da8b0094339caee6aac09a320ceb
5
5
  SHA512:
6
- metadata.gz: 5860e1862e58902dc358529e35891900e377fc0055bd8ed9fc9dfe653c49d2f719f8e507705e9372b462678979595c00bd607298cdfe296b6d3d2d14b63ba268
7
- data.tar.gz: 3dc82d00fb68f8baf5d9d4115be52c8bca5b841768178fb036889873020b9ea559acf3b5da076692872865fb963eee39a9c72351eb9df975e45bc8d51281bedb
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"
data/Rakefile CHANGED
@@ -1,7 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
 
4
- require 'devops_helper'
4
+ #require 'devops_helper'
5
+ require 'devops_assist'
5
6
 
6
7
  Rake::TestTask.new(:test) do |t|
7
8
  t.libs << "test"
@@ -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.25.1"
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,48 +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
42
+
43
+ # def is_dev?
44
+ # ENV.keys.include?("TLOGGER_MODE") and ENV["TLOGGER_MODE"].downcase == "dev"
45
+ # end
46
+
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
39
68
 
40
- private
41
- def output_channel
42
- out = ENV["TLOGGER_OUT"]
43
- if not out.nil?
44
- case out
45
- when "file"
46
- path = ENV["TLOGGER_OUTPATH"]
47
- if path =~ /,/
48
- { mode: :file, path: path.split(",") }
49
- else
50
- { mode: :file, path: [path] }
51
- end
52
- else
53
- { mode: :file, path: [nil] }
54
- end
55
- else
56
- { mode: :stdio, path: [nil] }
57
- end
58
- end
59
- end # class self
60
69
 
61
70
  end
62
71
 
72
+ TloggerHelper = Tlogger::TloggerHelper
73
+ #v = $VERBOSE
74
+ #$VERBOSE = nil
75
+ #Tlogger = Tlogger::Tlogger
76
+ #$VERBOSE = v
77
+
@@ -0,0 +1,45 @@
1
+
2
+ module Tlogger
3
+ module TloggerHelper
4
+
5
+ module ClassMethods
6
+ def init_tlogger(opts = { })
7
+ @opts = opts
8
+ end
9
+
10
+ def tlogger
11
+ if @tlogger.nil?
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?
28
+ end
29
+ @tlogger
30
+ end
31
+
32
+ end
33
+
34
+ def self.included(klass)
35
+ klass.extend(ClassMethods)
36
+ end
37
+
38
+ def tlogger
39
+ self.class.tlogger
40
+ end
41
+
42
+ end
43
+ end
44
+
45
+
data/tlogger.gemspec CHANGED
@@ -28,5 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
30
 
31
- spec.add_development_dependency "devops_helper"
31
+ #spec.add_development_dependency "devops_helper"
32
+ spec.add_development_dependency "devops_assist"
33
+
32
34
  end
metadata CHANGED
@@ -1,17 +1,17 @@
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-09 00:00:00.000000000 Z
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: devops_helper
14
+ name: devops_assist
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -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
@@ -45,6 +46,7 @@ files:
45
46
  - lib/tlogger/logger_group.rb
46
47
  - lib/tlogger/tlogger.rb
47
48
  - lib/tlogger/version.rb
49
+ - lib/tlogger_helper.rb
48
50
  - samples/basic.rb
49
51
  - samples/group.rb
50
52
  - tlogger.gemspec