pyer-logger 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/pyer/logger.rb +51 -52
  3. metadata +20 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c1fb8264eb6b552bd6372448e9a4892081592355
4
- data.tar.gz: 30cbb717001f157d12c927f06c9df5417c26f0b1
2
+ SHA256:
3
+ metadata.gz: 36b25b0fe284bd8915c3b5e6f0eda445d8e593b0280e6ef44a984b6058e43830
4
+ data.tar.gz: 88cd6a283b0efdad5b971d50e73562ea2835d12e5007cc2cdfca17d64cf274e6
5
5
  SHA512:
6
- metadata.gz: a795511e7737515fcf133e42981f5da3728e05c77ea32b40987a90516d2c5540cd75bb2be3c5a1756f3ec74c66ece4bf127b7f5d461337adb133d714b81ebf7c
7
- data.tar.gz: bfc035a8d4e80dfc68ca9dab9291c32c3c4bc755365448f57cc37bbb09decfdc9cdcc89665e176cc8e34592c2bc1675c040101d7df936eec2722fa85ec2abfd0
6
+ metadata.gz: 5b321bea4ec569f47a6f8efe73404e1c46ae208db70af1634193d8523d711fad80dd5bb23ac7fd3aceeaff249c7b5fda0ce07dbed4aaeba21842b44ed73f6782
7
+ data.tar.gz: eb221ae9a9a48a74aebfebdd7cd544418ce2de37d5addfb3db2401fab137f0ad013ef21c670fee050a37ed6c4879540d94fb8a7853f3901c87c5fc9529e65294
data/lib/pyer/logger.rb CHANGED
@@ -2,81 +2,77 @@
2
2
  #
3
3
  # This Logger class provides a simple logging utility for Ruby applications.
4
4
  # Log messages are sent to stdout, stderr, a file or a string by a Logger object.
5
- #
5
+ #
6
6
  # The messages will have varying levels reflecting their varying importance.
7
7
  # The levels, and their meanings, are:
8
- # * ERROR : an error condition
9
- # * WARN : a warning
10
- # * INFO : generic (useful) information about system operation
11
- # * DEBUG : low-level information for developers
12
- #
8
+ # 1. DEBUG : low-level information for developers
9
+ # 2. INFO : generic (useful) information about system operation
10
+ # 3. WARN : a warning
11
+ # 4. ERROR : an error condition
12
+ #
13
13
  # So each message has a level, and the Logger itself has a level, which acts
14
14
  # as a filter, so you can control the amount of information emitted from the
15
15
  # logger without having to remove actual messages.
16
- #
17
- # How to create a logger ?
18
- # ------------------------
19
- #
16
+ #
17
+ # == How to create a logger ?
18
+ #
20
19
  # 1. Create a logger which logs messages to STDERR/STDOUT.
21
20
  # log = Logger.new(STDOUT, self.class)
22
21
  # log = Logger.new(STDERR, self.class)
23
- #
22
+ #
24
23
  # 2. Create a logger for the file which has the specified name.
25
24
  # log = Logger.new('logfile.log', self.class)
26
- #
25
+ #
27
26
  # 3. Create a logger which logs messages to a string.
28
27
  # log = Logger.new(STRING, self.class)
29
- #
28
+ #
30
29
  # Notice that self.class argument prints the class name of the caller object.
31
- #
32
- # How to log a message ?
33
- # ----------------------
34
- #
30
+ #
31
+ # == How to log a message ?
32
+ #
35
33
  # Notice the different methods being used to log messages of various levels.
34
+ #
36
35
  # Messages lower than log.level are not sent to output.
37
- #
36
+ #
37
+ # Ranking: DEBUG < INFO < WARN < ERROR
38
+ #
38
39
  # Default log.level is DEBUG. That means all messages are emitted.
39
- #
40
- # DEBUG < INFO < WARN < ERROR
41
- #
42
- # 1. log.error "error is #{ @code }"
43
- #
44
- # 2. log.warn "a warning message"
45
- #
46
- # 3. log.info "some informations"
47
- #
48
- # 4. log.debug "dev info"
49
- #
40
+ #
41
+ # 1. Debug message
42
+ # log.debug "dev info"
43
+ #
44
+ # 2. Information
45
+ # log.info "some informations"
46
+ #
47
+ # 3. Warning message
48
+ # log.warn "a warning message"
49
+ #
50
+ # 4. Error message
51
+ # log.error "error is #{ @code }"
52
+ #
50
53
  # Messages are provided in a string or in a block, or both.
51
- #
54
+ #
52
55
  # 1. Message in block.
53
- #
54
56
  # log.error { "Argument 'foo' not given." }
55
- #
57
+ #
56
58
  # 2. Message as a string.
57
- #
58
59
  # log.error "Argument #{ @foo } mismatch."
59
- #
60
+ #
60
61
  # 3. Both arguments
61
- #
62
- # log.error("Argument ") { "#{ @foo } mismatch." }
63
- #
64
- # How to set severity level ?
65
- # ---------------------------
66
- #
62
+ # log.error("Argument ") { "#{ @foo } mismatch." }
63
+ #
64
+ # == How to set severity level ?
65
+ #
67
66
  # log.level = INFO
68
- #
69
- # How to close a logger ?
70
- # -----------------------
71
- #
67
+ #
68
+ # == How to close a logger ?
69
+ #
72
70
  # log.close
73
- #
74
- #
75
- # Installation
76
- # ------------
77
- #
78
- # gem install pyer-options
79
- #
71
+ #
72
+ # == Installation
73
+ #
74
+ # gem install pyer-logger
75
+ #
80
76
  module Pyer
81
77
  require 'stringio'
82
78
 
@@ -215,7 +211,10 @@ module Pyer
215
211
  end
216
212
  end
217
213
 
218
- # Backward-compatible alias
214
+ # == Aliases
215
+ #
216
+ # Aliases are made to make life simpler.
217
+ #
219
218
  Logger = Pyer::Logger
220
219
  STRING = Pyer::Logger::STRING
221
220
 
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pyer-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre BAZONNARD
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date:
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: stringio
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '0'
33
+ version: '12.3'
20
34
  type: :development
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '0'
40
+ version: '12.3'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: minitest
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -46,7 +60,7 @@ extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
48
62
  - lib/pyer/logger.rb
49
- homepage: https://github.com/pyer/logger
63
+ homepage: https://github.com/pyer/pyer-logger
50
64
  licenses:
51
65
  - MIT
52
66
  metadata: {}
@@ -65,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
79
  - !ruby/object:Gem::Version
66
80
  version: '0'
67
81
  requirements: []
68
- rubyforge_project:
69
- rubygems_version: 2.4.5
82
+ rubygems_version: 3.1.2
70
83
  signing_key:
71
84
  specification_version: 4
72
85
  summary: Logger