pyer-logger 1.0.0 → 1.0.1

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 +4 -4
  2. data/lib/pyer/logger.rb +69 -46
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4894005ac53da8f7ef99404bb956084a6597b74a
4
- data.tar.gz: a1f12c6a90d1f0b40119569ea4e644f0cacf4179
3
+ metadata.gz: c1fb8264eb6b552bd6372448e9a4892081592355
4
+ data.tar.gz: 30cbb717001f157d12c927f06c9df5417c26f0b1
5
5
  SHA512:
6
- metadata.gz: 1e2d24fc6088ae0e165f7c5161e3f1a503e90134669dfb071974676df6d578079691a67e5ee7bd393aad16828c3245afaaff875c7daf87b89677551add4af111
7
- data.tar.gz: ad1bdecdf44243373a05c67c52cddd8eea57060a027bd43770bdf1732ba5104b4071027c86c8d2da4cd82e8e84f4d3182a045f754b9a3213d3e4a64f96d6ef5c
6
+ metadata.gz: a795511e7737515fcf133e42981f5da3728e05c77ea32b40987a90516d2c5540cd75bb2be3c5a1756f3ec74c66ece4bf127b7f5d461337adb133d714b81ebf7c
7
+ data.tar.gz: bfc035a8d4e80dfc68ca9dab9291c32c3c4bc755365448f57cc37bbb09decfdc9cdcc89665e176cc8e34592c2bc1675c040101d7df936eec2722fa85ec2abfd0
data/lib/pyer/logger.rb CHANGED
@@ -1,59 +1,82 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # == Description
4
- #
5
- # The Logger class provides a simple logging utility.
6
- #
7
- # You create a Logger object (output to a file, STDOUT or STDERR).
8
- # The messages will have varying levels (+info+, +error+, etc),
9
- # reflecting their varying importance.
10
- #
3
+ # This Logger class provides a simple logging utility for Ruby applications.
4
+ # Log messages are sent to stdout, stderr, a file or a string by a Logger object.
5
+ #
6
+ # The messages will have varying levels reflecting their varying importance.
11
7
  # The levels, and their meanings, are:
12
- # +ERROR+:: an error condition
13
- # +WARN +:: a warning
14
- # +INFO +:: generic (useful) information about system operation
15
- # +DEBUG+:: low-level information for developers
16
- #
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
+ #
17
13
  # So each message has a level, and the Logger itself has a level, which acts
18
14
  # as a filter, so you can control the amount of information emitted from the
19
15
  # logger without having to remove actual messages.
20
- #
21
- # == HOWTOs
22
- #
23
- # === How to create a logger
24
- #
16
+ #
17
+ # How to create a logger ?
18
+ # ------------------------
19
+ #
25
20
  # 1. Create a logger which logs messages to STDERR/STDOUT.
26
- # logger = Logger.new(STDOUT)
27
- # logger = Logger.new(STDERR)
28
- #
21
+ # log = Logger.new(STDOUT, self.class)
22
+ # log = Logger.new(STDERR, self.class)
23
+ #
29
24
  # 2. Create a logger for the file which has the specified name.
30
- # logger = Logger.new('logfile.log')
31
- #
32
- # === How to log a message
33
- #
34
- # Notice the different methods (+fatal+, +error+, +warn+, +info+, +debug+)
35
- # being used to log messages of various levels.
36
- # Messages lower than logger.level are not emitted.
37
- #
25
+ # log = Logger.new('logfile.log', self.class)
26
+ #
27
+ # 3. Create a logger which logs messages to a string.
28
+ # log = Logger.new(STRING, self.class)
29
+ #
30
+ # Notice that self.class argument prints the class name of the caller object.
31
+ #
32
+ # How to log a message ?
33
+ # ----------------------
34
+ #
35
+ # Notice the different methods being used to log messages of various levels.
36
+ # Messages lower than log.level are not sent to output.
37
+ #
38
+ # 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
+ #
50
+ # Messages are provided in a string or in a block, or both.
51
+ #
38
52
  # 1. Message in block.
39
- #
40
- # logger.error { "Argument 'foo' not given." }
41
- #
53
+ #
54
+ # log.error { "Argument 'foo' not given." }
55
+ #
42
56
  # 2. Message as a string.
43
- #
44
- # logger.error "Argument #{ @foo } mismatch."
45
- #
46
- # === How to set severity level
47
- #
48
- # logger.level = Logger::INFO
49
- #
50
- # DEBUG < INFO < WARN < ERROR
51
- #
52
- # === How to close a logger
53
- #
54
- # logger.close
55
- #
56
- # All my tools are in module Pyer
57
+ #
58
+ # log.error "Argument #{ @foo } mismatch."
59
+ #
60
+ # 3. Both arguments
61
+ #
62
+ # log.error("Argument ") { "#{ @foo } mismatch." }
63
+ #
64
+ # How to set severity level ?
65
+ # ---------------------------
66
+ #
67
+ # log.level = INFO
68
+ #
69
+ # How to close a logger ?
70
+ # -----------------------
71
+ #
72
+ # log.close
73
+ #
74
+ #
75
+ # Installation
76
+ # ------------
77
+ #
78
+ # gem install pyer-options
79
+ #
57
80
  module Pyer
58
81
  require 'stringio'
59
82
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pyer-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
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-28 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake