pyer-logger 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/pyer/logger.rb +29 -26
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cfe5eb4450466ce500d531c8387fa1bb68ca067cd24f3d157d15aff430c4f3eb
|
4
|
+
data.tar.gz: ec47c032c54a93ede55646dcda9ed9453faa062ef988e584d8be8786e4b43ab6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef48c10d8a933f515553cd2eb383272489e89e387fbb00a07cccaf8b92d1b3d3386b2f598f5c15bf0980b46ea91ba595d18f8d8cdad450c2424cd6fb794045a9
|
7
|
+
data.tar.gz: 64e699ebac5d25f2f0f2409f98a70971d4482731f4f0495836f134e0bb66bc6024dd58c0063525b40d72ae116599f818bdc48def8db4950cfcaa9b0bf5dc0706
|
data/lib/pyer/logger.rb
CHANGED
@@ -2,34 +2,34 @@
|
|
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
8
|
# 1. DEBUG : low-level information for developers
|
9
9
|
# 2. INFO : generic (useful) information about system operation
|
10
10
|
# 3. WARN : a warning
|
11
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
17
|
# == How to create a logger ?
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# 1. Create a logger which logs messages to STDERR/STDOUT.
|
20
20
|
# log = Logger.new(STDOUT, self.class)
|
21
21
|
# log = Logger.new(STDERR, self.class)
|
22
|
-
#
|
22
|
+
#
|
23
23
|
# 2. Create a logger for the file which has the specified name.
|
24
24
|
# log = Logger.new('logfile.log', self.class)
|
25
|
-
#
|
25
|
+
#
|
26
26
|
# 3. Create a logger which logs messages to a string.
|
27
27
|
# log = Logger.new(STRING, self.class)
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# Notice that self.class argument prints the class name of the caller object.
|
30
|
-
#
|
30
|
+
#
|
31
31
|
# == How to log a message ?
|
32
|
-
#
|
32
|
+
#
|
33
33
|
# Notice the different methods being used to log messages of various levels.
|
34
34
|
#
|
35
35
|
# Messages lower than log.level are not sent to output.
|
@@ -37,42 +37,42 @@
|
|
37
37
|
# Ranking: DEBUG < INFO < WARN < ERROR
|
38
38
|
#
|
39
39
|
# Default log.level is DEBUG. That means all messages are emitted.
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# 1. Debug message
|
42
42
|
# log.debug "dev info"
|
43
|
-
#
|
43
|
+
#
|
44
44
|
# 2. Information
|
45
45
|
# log.info "some informations"
|
46
|
-
#
|
46
|
+
#
|
47
47
|
# 3. Warning message
|
48
48
|
# log.warn "a warning message"
|
49
|
-
#
|
49
|
+
#
|
50
50
|
# 4. Error message
|
51
51
|
# log.error "error is #{ @code }"
|
52
|
-
#
|
52
|
+
#
|
53
53
|
# Messages are provided in a string or in a block, or both.
|
54
|
-
#
|
54
|
+
#
|
55
55
|
# 1. Message in block.
|
56
56
|
# log.error { "Argument 'foo' not given." }
|
57
|
-
#
|
57
|
+
#
|
58
58
|
# 2. Message as a string.
|
59
59
|
# log.error "Argument #{ @foo } mismatch."
|
60
|
-
#
|
60
|
+
#
|
61
61
|
# 3. Both arguments
|
62
|
-
# log.error("Argument ") { "#{ @foo } mismatch." }
|
63
|
-
#
|
62
|
+
# log.error("Argument ") { "#{ @foo } mismatch." }
|
63
|
+
#
|
64
64
|
# == How to set severity level ?
|
65
65
|
#
|
66
66
|
# log.level = INFO
|
67
|
-
#
|
67
|
+
#
|
68
68
|
# == How to close a logger ?
|
69
|
-
#
|
69
|
+
#
|
70
70
|
# log.close
|
71
|
-
#
|
71
|
+
#
|
72
72
|
# == Installation
|
73
|
-
#
|
74
|
-
# gem install pyer-
|
75
|
-
#
|
73
|
+
#
|
74
|
+
# gem install pyer-logger
|
75
|
+
#
|
76
76
|
module Pyer
|
77
77
|
require 'stringio'
|
78
78
|
|
@@ -211,7 +211,10 @@ module Pyer
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
|
-
#
|
214
|
+
# == Aliases
|
215
|
+
#
|
216
|
+
# Aliases are made to make life simpler.
|
217
|
+
#
|
215
218
|
Logger = Pyer::Logger
|
216
219
|
STRING = Pyer::Logger::STRING
|
217
220
|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pyer-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre BAZONNARD
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date:
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 12.3.3
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 12.3.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,8 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
|
-
|
69
|
-
rubygems_version: 2.4.5
|
68
|
+
rubygems_version: 3.1.2
|
70
69
|
signing_key:
|
71
70
|
specification_version: 4
|
72
71
|
summary: Logger
|