pyer-logger 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pyer/logger.rb +22 -26
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7439de8b230e777556ad8338f1f20eea207fcae
|
4
|
+
data.tar.gz: 26454618ccb4283a7d315cb08fa8d7f072e46bb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd2e3a78cb157f407df769b086f3b473301653766847272385986d6bc7847ec3f37c3a4d653b39b9a362926df0a481bc891f247da37f143055d5d92950bc76be
|
7
|
+
data.tar.gz: d64485503494cebc39af119faeb6cba7db1dad0ea343218c24825953f8cdec7de40a28c9498d36f9f8816c9f7cdd83011ed03993c471bdd85acd206699ee7f67
|
data/lib/pyer/logger.rb
CHANGED
@@ -5,17 +5,16 @@
|
|
5
5
|
#
|
6
6
|
# The messages will have varying levels reflecting their varying importance.
|
7
7
|
# The levels, and their meanings, are:
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
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
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
16
|
#
|
17
|
-
# How to create a logger ?
|
18
|
-
# ------------------------
|
17
|
+
# == How to create a logger ?
|
19
18
|
#
|
20
19
|
# 1. Create a logger which logs messages to STDERR/STDOUT.
|
21
20
|
# log = Logger.new(STDOUT, self.class)
|
@@ -29,51 +28,48 @@
|
|
29
28
|
#
|
30
29
|
# Notice that self.class argument prints the class name of the caller object.
|
31
30
|
#
|
32
|
-
# How to log a message ?
|
33
|
-
# ----------------------
|
31
|
+
# == How to log a message ?
|
34
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
|
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
# 1. log.error "error is #{ @code }"
|
41
|
+
# 1. Debug message
|
42
|
+
# log.debug "dev info"
|
43
43
|
#
|
44
|
-
# 2.
|
44
|
+
# 2. Information
|
45
|
+
# log.info "some informations"
|
45
46
|
#
|
46
|
-
# 3.
|
47
|
+
# 3. Warning message
|
48
|
+
# log.warn "a warning message"
|
47
49
|
#
|
48
|
-
# 4.
|
50
|
+
# 4. Error message
|
51
|
+
# log.error "error is #{ @code }"
|
49
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
62
|
# log.error("Argument ") { "#{ @foo } mismatch." }
|
63
63
|
#
|
64
|
-
# How to set severity level ?
|
65
|
-
#
|
66
|
-
#
|
64
|
+
# == How to set severity level ?
|
65
|
+
#
|
67
66
|
# log.level = INFO
|
68
67
|
#
|
69
|
-
# How to close a logger ?
|
70
|
-
# -----------------------
|
68
|
+
# == How to close a logger ?
|
71
69
|
#
|
72
70
|
# log.close
|
73
71
|
#
|
74
|
-
#
|
75
|
-
# Installation
|
76
|
-
# ------------
|
72
|
+
# == Installation
|
77
73
|
#
|
78
74
|
# gem install pyer-options
|
79
75
|
#
|