GunnyLog 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +44 -5
- data/lib/GunnyLog.rb +1 -0
- data/lib/GunnyLog/severity.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e41155a51ea56ff543fc309d20fa7743403d6f1d
|
4
|
+
data.tar.gz: 3a2eb153d94af83597568e98cba2634c6b4ec1a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41f08db67114f6c361c240d29dbeeec0316250f851fc13d22fc0653a77e79642e01e14c5a32754e68e16fe1d93a0e224caba2b54f14d9d48f5f0f11867fd1b98
|
7
|
+
data.tar.gz: 2ffca048b6d9f4f107fda49abd31af4bee903952cee69058a481a04892081c58b91cf115b303d122dcf528699eacb48947c60f9f332b05c789e95b0baa7a8c31
|
data/README.md
CHANGED
@@ -24,10 +24,18 @@ Or install it yourself as:
|
|
24
24
|
require 'GunnyLog'
|
25
25
|
|
26
26
|
### Example of screen logging, one liners
|
27
|
+
|
28
|
+
#### Sample code
|
27
29
|
GunnyLog.instance.message('Main:Runloop', 'Error loading preferences')<br>
|
28
30
|
GunnyLog.instance.message_formatted('TestClass:GetUrl', 'Error number = %d', 40)<br>
|
29
31
|
|
32
|
+
#### Sample output
|
33
|
+
09/11/2014|03:33:58PM|testapp01.rb|Main:Runloop|Error loading preferences<br>
|
34
|
+
09/11/2014|03:33:58PM|testapp01.rb|TestClass:GetUrl|Error number = 40<br>
|
35
|
+
|
30
36
|
### Example of screen logging
|
37
|
+
|
38
|
+
#### Sample code
|
31
39
|
logs = GunnyLog.instance<br>
|
32
40
|
|
33
41
|
logs.message('Testing GunnyScreenLog 01')<br>
|
@@ -46,7 +54,19 @@ logs.message('sort','Testing GunnyScreenLog 03')<br>
|
|
46
54
|
logs.message_formatted('name: %s, age: %d, job: %s', ['Gunny', 42, 'Developer'])<br>
|
47
55
|
logs.message_formatted_vars(nil, 'name: %s, age: %d, job: %s', 'Gunny', 42, 'Developer')<br>
|
48
56
|
|
57
|
+
#### Sample output
|
58
|
+
09/11/2014|03:33:58PM|testapp01.rb|TestClass:GetUrl|Testing GunnyScreenLog 01<br>
|
59
|
+
09/11/2014|03:33:58PM|testapp01.rb|init|Testing GunnyScreenLog 01<br>
|
60
|
+
09/11/2014|03:33:58PM|testapp01.rb|destroy|Testing GunnyScreenLog 02<br>
|
61
|
+
09/11/2014|03:33:58PM|testapp01.rb|read|Testing GunnyScreenLog 02<br>
|
62
|
+
09/11/2014|03:33:58PM|testapp01.rb|sort|Testing GunnyScreenLog 03<br>
|
63
|
+
09/11/2014|03:33:58PM|testapp01.rb|sort|name: Gunny, age: 42, job: Developer<br>
|
64
|
+
09/11/2014|03:33:58PM|testapp01.rb|sort|name: Gunny, age: 42, job: Developer<br>
|
65
|
+
|
66
|
+
|
49
67
|
### Example of file logging
|
68
|
+
|
69
|
+
#### Sample code
|
50
70
|
logf = GunnyLogFile.instance<br>
|
51
71
|
logf.open('testapp.log')<br>
|
52
72
|
|
@@ -68,9 +88,7 @@ logf.message_formatted_vars(nil, 'name: %s, age: %d, job: %s', 'Gunny', 42, 'Dev
|
|
68
88
|
|
69
89
|
logf.close<br>
|
70
90
|
|
71
|
-
|
72
|
-
09/11/2014|03:33:58PM|testapp01.rb|Main:Runloop|Error loading preferences<br>
|
73
|
-
09/11/2014|03:33:58PM|testapp01.rb|TestClass:GetUrl|Error number = 40<br>
|
91
|
+
#### Sample output
|
74
92
|
09/11/2014|03:33:58PM|testapp01.rb|TestClass:GetUrl|Testing GunnyScreenLog 01<br>
|
75
93
|
09/11/2014|03:33:58PM|testapp01.rb|init|Testing GunnyScreenLog 01<br>
|
76
94
|
09/11/2014|03:33:58PM|testapp01.rb|destroy|Testing GunnyScreenLog 02<br>
|
@@ -79,6 +97,28 @@ logf.close<br>
|
|
79
97
|
09/11/2014|03:33:58PM|testapp01.rb|sort|name: Gunny, age: 42, job: Developer<br>
|
80
98
|
09/11/2014|03:33:58PM|testapp01.rb|sort|name: Gunny, age: 42, job: Developer<br>
|
81
99
|
|
100
|
+
|
101
|
+
### Example of logging with logging level
|
102
|
+
|
103
|
+
#### Sample code
|
104
|
+
logl = GunnyLog.instance<br>
|
105
|
+
|
106
|
+
logl.set_logging_level(GunnyLog::ERROR)<br>
|
107
|
+
logl.log_fatal('main', 'error message')<br>
|
108
|
+
logl.log_error('main', 'error message')<br>
|
109
|
+
logl.log_info('main', 'error message')<br>
|
110
|
+
|
111
|
+
logl.set_logging_level(GunnyLog::WARNING)<br>
|
112
|
+
logl.log_warning('main', 'error message')<br>
|
113
|
+
logl.log_unknown('main', 'error message')<br>
|
114
|
+
logl.log_debug('main', 'error message')<br>
|
115
|
+
|
116
|
+
#### Sample output
|
117
|
+
09/13/2014|06:55:56AM|testapp01.rb|FATAL|main|error message<br>
|
118
|
+
09/13/2014|06:55:56AM|testapp01.rb|ERROR|main|error message<br>
|
119
|
+
09/13/2014|06:55:56AM|testapp01.rb|WARNING|main|error message<br>
|
120
|
+
09/13/2014|06:55:56AM|testapp01.rb|UNKNOWN|main|error message<br>
|
121
|
+
|
82
122
|
## Documentation
|
83
123
|
|
84
124
|
http://rubydoc.info/gems/GunnyLog/frames/index
|
@@ -91,5 +131,4 @@ http://rubydoc.info/gems/GunnyLog/frames/index
|
|
91
131
|
4. Push to the branch (`git push origin my-new-feature`)
|
92
132
|
5. Create a new Pull Request
|
93
133
|
|
94
|
-
Thanks!
|
95
|
-
Gunny
|
134
|
+
Thanks! Gunny
|
data/lib/GunnyLog.rb
CHANGED
@@ -4,6 +4,7 @@ require 'GunnyLog/severity'
|
|
4
4
|
require 'singleton'
|
5
5
|
require 'date'
|
6
6
|
|
7
|
+
|
7
8
|
# GunnyLog logs messages to stdout, stderr, or a file. It defaults
|
8
9
|
# to stdout. GunnyLog is a singleton and uses the instance method.
|
9
10
|
# For example you can use GunnyLog.instance.msg('Error message')
|
data/lib/GunnyLog/severity.rb
CHANGED
@@ -6,15 +6,22 @@ class GunnyLog
|
|
6
6
|
|
7
7
|
public
|
8
8
|
|
9
|
+
# Log level DEBUG
|
9
10
|
DEBUG = 0
|
11
|
+
# Log level INFO
|
10
12
|
INFO = 1
|
13
|
+
# Log level WARNING
|
11
14
|
WARNING = 2
|
15
|
+
# Log level ERROR
|
12
16
|
ERROR = 3
|
17
|
+
# Log level FATAL
|
13
18
|
FATAL = 4
|
19
|
+
# Log level UNKNOWN
|
14
20
|
UNKNOWN = 5
|
15
21
|
|
16
22
|
private
|
17
23
|
|
24
|
+
# get string for level
|
18
25
|
def level_string(level)
|
19
26
|
case level
|
20
27
|
when 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: GunnyLog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GunnyHwy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby class for logging to stdout, stderr, or a file
|
14
14
|
email: gunnyhwy21@yahoo.com
|