tee_logger 2.0.2 → 2.1.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
  SHA1:
3
- metadata.gz: ca99dab6608c1d15dbe0f8cd11cac028852ed8b4
4
- data.tar.gz: 858e50b42da55245169f41dc385d51a662281836
3
+ metadata.gz: 663a9c80a5e899c9afa6337089e51c94578c9ef9
4
+ data.tar.gz: d5522bc64ca244eebfd8f26d43f9c3fdd891f100
5
5
  SHA512:
6
- metadata.gz: 43fa36b1ae448c15daf3df9f996fcc06c92bcf4fb159595a776e6544efe506dc5396868894b493dfa429edc424ba5c1aec4eb0e732a2a4335a8890e8bce9e817
7
- data.tar.gz: 40632dd5e7576e793c1aaf7d9f774c0f9b697bfc69bca6ce377b0dd498841c044ca22c8c619001d0f8d1d9b20bae1169538c787e5eb0ec7bf36c4072fcbf25d7
6
+ metadata.gz: 9b0d14d1bf676de05350d675cbbdd2ad1d92f3d28b8da8cff88b8889203cb08503dc863ef444d5b982c9620a12abed70dfe72268e486644330c853143bc8423e
7
+ data.tar.gz: 8f78b5ed0bd35f1c138568052cb6af38dbfb3ea4b8a4b937aa632966f96258f257fed680a83a02c5386cb90083aed6cf013a702ceef73a988be148f71302f43d
@@ -0,0 +1,17 @@
1
+ # 2.1.0
2
+ - Integrate TeeLogger::Base class to TeeLogger::TeeLogger class
3
+
4
+ # 2.0.2
5
+ - bugfix
6
+
7
+ # 2.0.1
8
+ - bugfix
9
+
10
+ # 2.0.0
11
+ - Change to Class from Module
12
+
13
+ # 1.1.0
14
+ - bugfix
15
+
16
+ # 1.0.0
17
+ - first
data/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
  Sorry, I changed Usage.
5
5
 
6
- - [rubygems](https://rubygems.org/gems/tee_logger)
7
- - [github](https://github.com/k-ta-yamada/tee_logger)
6
+ - [Rubygems.org](https://rubygems.org/gems/tee_logger)
7
+ - [GitHub](https://github.com/k-ta-yamada/tee_logger)
8
8
 
9
9
  # TeeLogger
10
10
 
@@ -49,7 +49,8 @@ tl.console.info('console only')
49
49
  tl.logger.info('logger only')
50
50
  ```
51
51
 
52
- # TODO feature
52
+ ## TODO feature
53
+
53
54
  ```
54
55
  # disable and enable console output
55
56
  tl.disable(:console)
@@ -1,8 +1,7 @@
1
1
  require 'tee_logger/version'
2
2
  require 'tee_logger/constants'
3
- require 'tee_logger/base'
4
3
 
5
- require 'forwardable'
4
+ require 'logger'
6
5
 
7
6
  # namespace
8
7
  module TeeLogger
@@ -12,33 +11,54 @@ module TeeLogger
12
11
  end
13
12
 
14
13
  class TeeLogger
15
- extend Forwardable
16
-
17
14
  attr_reader :logger, :console
18
15
 
19
16
  def initialize(logdev = DEFAULT_FILE, shift_age = 0, shift_size = 1_048_576)
20
- @base_logger = Base.new(logdev, shift_age, shift_size)
21
- @logger = @base_logger.logger
22
- @console = @base_logger.console
17
+ @logger = Logger.new(logdev, shift_age, shift_size)
18
+ @console = Logger.new(STDOUT)
23
19
  end
24
20
 
25
21
  # logging methods.
26
- def_delegators :@base_logger, *LOGGING_METHODS
22
+ LOGGING_METHODS.each do |name|
23
+ define_method(name) do |progname = nil, &block|
24
+ @logger.send(name, progname, &block)
25
+ @console.send(name, progname, &block)
26
+ end
27
+ end
27
28
 
28
29
  # check logging level methods.
29
- def_delegators :@base_logger, *LOGGING_METHODS.map { |v| "#{v}?" }
30
+ LOGGING_METHODS.map { |v| "#{v}?" }.each do |name|
31
+ define_method(name) do
32
+ # TODO: which?
33
+ # @logger.send(name)
34
+ @console.send(name)
35
+ end
36
+ end
30
37
 
31
- # others.
32
- def_delegators :@base_logger, :progname, :progname=
38
+ # TODO: Implement!
39
+ def disable(target)
40
+ # undef_method, remove_method ....
41
+ end
33
42
 
34
- # TODO: Implement
35
- # def_delegators :@base_logger, :datetime_format, :datetime_format=
36
- # def_delegators :@base_logger, :formatter, :formatter=
43
+ # TODO: Implement!
44
+ def enable(target)
45
+ # undef_method, remove_method ....
46
+ end
47
+
48
+ def progname
49
+ # TODO: which?
50
+ # @logger.progname
51
+ @console.progname
52
+ end
53
+
54
+ def progname=(name = nil)
55
+ @logger.progname = name
56
+ @console.progname = name
57
+ end
37
58
 
38
- # TODO: Implement
39
- # def_delegator :@base_logger, :close
40
- # def_delegators :@base_logger, :level, :sev_threshold
41
- # def_delegators :@base_logger, :add, :log
42
- # def_delegators :@base_logger, :unknown, :unknown?
59
+ # def close
60
+ # @logger.close
61
+ # # @console.close
62
+ # end
43
63
  end
44
64
  end
@@ -1,4 +1,4 @@
1
1
  # namespace
2
2
  module TeeLogger
3
- VERSION = '2.0.2'
3
+ VERSION = '2.1.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tee_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k-ta-yamada
@@ -118,6 +118,7 @@ files:
118
118
  - ".gitignore"
119
119
  - ".rspec"
120
120
  - ".travis.yml"
121
+ - CHANGELOG.md
121
122
  - CODE_OF_CONDUCT.md
122
123
  - Gemfile
123
124
  - LICENSE.txt
@@ -126,7 +127,6 @@ files:
126
127
  - bin/console
127
128
  - bin/setup
128
129
  - lib/tee_logger.rb
129
- - lib/tee_logger/base.rb
130
130
  - lib/tee_logger/constants.rb
131
131
  - lib/tee_logger/version.rb
132
132
  - tee_logger.gemspec
@@ -1,56 +0,0 @@
1
- require 'logger'
2
-
3
- # namespace
4
- module TeeLogger
5
- # base class
6
- class Base
7
- attr_reader :logger, :console
8
-
9
- def initialize(logdev = DEFAULT_FILE, shift_age = 0, shift_size = 1_048_576)
10
- @logger = Logger.new(logdev, shift_age, shift_size)
11
- @console = Logger.new(STDOUT)
12
- end
13
-
14
- # logging methods.
15
- LOGGING_METHODS.each do |name|
16
- define_method(name) do |progname = nil, &block|
17
- @logger.send(name, progname, &block)
18
- @console.send(name, progname, &block)
19
- end
20
- end
21
-
22
- # check logging level methods.
23
- LOGGING_METHODS.map { |v| "#{v}?" }.each do |name|
24
- define_method(name) do
25
- @logger.send(name)
26
- @console.send(name)
27
- end
28
- end
29
-
30
- # TODO: Implement
31
- def disable(target)
32
- # undef_method, remove_method ....
33
- end
34
-
35
- # TODO: Implement
36
- def enable(target)
37
- # undef_method, remove_method ....
38
- end
39
-
40
- def progname
41
- # TODO: which?
42
- # @logger.progname
43
- @console.progname
44
- end
45
-
46
- def progname=(name = nil)
47
- @logger.progname = name
48
- @console.progname = name
49
- end
50
-
51
- def close
52
- @logger.close
53
- # @console.close
54
- end
55
- end
56
- end