highlogger 0.0.2 → 0.0.3
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.
- data/History.txt +4 -0
- data/config/hoe.rb +1 -1
- data/lib/highlogger.rb +65 -1
- data/lib/highlogger/version.rb +1 -1
- data/website/index.html +2 -2
- metadata +3 -3
data/History.txt
CHANGED
data/config/hoe.rb
CHANGED
@@ -5,7 +5,7 @@ EMAIL = "angelbob@nospam.users.sourceforge.net"
|
|
5
5
|
DESCRIPTION = "A heirarchical component-based logging system"
|
6
6
|
GEM_NAME = 'highlogger'
|
7
7
|
RUBYFORGE_PROJECT = 'ab-ext'
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
8
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org/highlogger"
|
9
9
|
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
10
|
|
11
11
|
@config_file = "~/.rubyforge/user-config.yml"
|
data/lib/highlogger.rb
CHANGED
@@ -11,6 +11,9 @@ class HighLogger < Logger
|
|
11
11
|
@default_level = Logger::WARN
|
12
12
|
end
|
13
13
|
|
14
|
+
# Adds a message to the log, with the given component name, severity,
|
15
|
+
# message (or block if no message), and program name.
|
16
|
+
#
|
14
17
|
def add(component, severity, message = nil, progname = nil, &block)
|
15
18
|
return if severity == :none
|
16
19
|
|
@@ -32,51 +35,85 @@ class HighLogger < Logger
|
|
32
35
|
|
33
36
|
alias log add
|
34
37
|
|
38
|
+
# Returns whether a DEBUG log message will be visible for the
|
39
|
+
# given component, if any, or by default if no arg is given.
|
40
|
+
#
|
35
41
|
def debug?(*args)
|
36
42
|
return super() if args.empty?
|
37
43
|
@logmap[args[0]] <= Logger::DEBUG
|
38
44
|
end
|
39
45
|
|
46
|
+
# Returns whether an INFO log message will be visible for the
|
47
|
+
# given component, if any, or by default if no arg is given.
|
48
|
+
#
|
40
49
|
def info?(*args)
|
41
50
|
return super() if args.empty?
|
42
51
|
@logmap[args[0]] <= Logger::INFO
|
43
52
|
end
|
44
53
|
|
54
|
+
# Returns whether a WARN log message will be visible for the
|
55
|
+
# given component, if any, or by default if no arg is given.
|
56
|
+
#
|
45
57
|
def warn?(*args)
|
46
58
|
return super() if args.empty?
|
47
59
|
@logmap[args[0]] <= Logger::WARN
|
48
60
|
end
|
49
61
|
|
62
|
+
# Returns whether an ERROR log message will be visible for the
|
63
|
+
# given component, if any, or by default if no arg is given.
|
64
|
+
#
|
50
65
|
def error?(*args)
|
51
66
|
return super() if args.empty?
|
52
67
|
@logmap[args[0]] <= Logger::ERROR
|
53
68
|
end
|
54
69
|
|
70
|
+
# Returns whether a FATAL log message will be visible for the
|
71
|
+
# given component, if any, or by default if no arg is given.
|
72
|
+
#
|
55
73
|
def fatal?(*args)
|
56
74
|
return super() if args.empty?
|
57
75
|
@logmap[args[0]] <= Logger::FATAL
|
58
76
|
end
|
59
77
|
|
78
|
+
# Logs a DEBUG message for the given component name and progname,
|
79
|
+
# using the given block as the output message.
|
80
|
+
#
|
60
81
|
def debug(component, progname = nil, &block)
|
61
82
|
add(component, Logger::DEBUG, nil, progname, &block)
|
62
83
|
end
|
63
84
|
|
85
|
+
# Logs an INFO message for the given component name and progname,
|
86
|
+
# using the given block as the output message.
|
87
|
+
#
|
64
88
|
def info(component, progname = nil, &block)
|
65
89
|
add(component, Logger::INFO, nil, progname, &block)
|
66
90
|
end
|
67
91
|
|
92
|
+
# Logs a WARN message for the given component name and progname,
|
93
|
+
# using the given block as the output message.
|
94
|
+
#
|
68
95
|
def warn(component, progname = nil, &block)
|
69
96
|
add(component, Logger::WARN, nil, progname, &block)
|
70
97
|
end
|
71
98
|
|
99
|
+
# Logs an ERROR message for the given component name and progname,
|
100
|
+
# using the given block as the output message.
|
101
|
+
#
|
72
102
|
def error(component, progname = nil, &block)
|
73
103
|
add(component, Logger::ERROR, nil, progname, &block)
|
74
104
|
end
|
75
105
|
|
106
|
+
# Logs a FATAL message for the given component name and progname,
|
107
|
+
# using the given block as the output message.
|
108
|
+
#
|
76
109
|
def fatal(component, progname = nil, &block)
|
77
110
|
add(component, Logger::FATAL, nil, progname, &block)
|
78
111
|
end
|
79
112
|
|
113
|
+
# Logs an UNKNOWN message for the given component name and progname,
|
114
|
+
# using the given block as the output message. UNKNOWN is more severe
|
115
|
+
# than even FATAL.
|
116
|
+
#
|
80
117
|
def unknown(component, progname = nil, &block)
|
81
118
|
add(component, Logger::UNKNOWN, nil, progname, &block)
|
82
119
|
end
|
@@ -102,7 +139,7 @@ class HighLogger < Logger
|
|
102
139
|
loglevel = parse_loglevel(mobj[2])
|
103
140
|
if mobj[1] =~ /default/i
|
104
141
|
@default_level = loglevel
|
105
|
-
parent.level = loglevel
|
142
|
+
#parent.level = loglevel
|
106
143
|
next
|
107
144
|
end
|
108
145
|
|
@@ -155,19 +192,33 @@ class HighLogger < Logger
|
|
155
192
|
|
156
193
|
end # class HighLogger
|
157
194
|
|
195
|
+
# LogSource sets up simple logging functions accessible from a class's
|
196
|
+
# namespace when it is included. A logger and component name are usually
|
197
|
+
# set in the initialize() function of the including object. The default
|
198
|
+
# logger will log to STDERR, and the default component name is the caller's
|
199
|
+
# file name.
|
200
|
+
#
|
158
201
|
module LogSource
|
159
202
|
@@highlogger_default_logger = HighLogger.new(STDERR)
|
160
203
|
@highlogger_logger = nil
|
161
204
|
|
205
|
+
# Set the HighLogger or other Logger that this LogSource will log to.
|
206
|
+
# The given object must accept an appropriate @add()@ method call.
|
207
|
+
#
|
162
208
|
def set_logger(logger_obj)
|
163
209
|
@highlogger_logger = logger_obj
|
164
210
|
@highlogger_component = nil
|
165
211
|
end
|
166
212
|
|
213
|
+
# Set the component string that the LogSource reports with.
|
214
|
+
#
|
167
215
|
def set_component(comp_name)
|
168
216
|
@highlogger_component = comp_name
|
169
217
|
end
|
170
218
|
|
219
|
+
# Add a message to the current logger, with the appropriate component
|
220
|
+
# name.
|
221
|
+
#
|
171
222
|
def log(severity, *strings, &block)
|
172
223
|
if @highlogger_component
|
173
224
|
comp = @highlogger_component
|
@@ -186,26 +237,39 @@ module LogSource
|
|
186
237
|
|
187
238
|
alias add log
|
188
239
|
|
240
|
+
# Log a DEBUG message to the current logger and component.
|
241
|
+
#
|
189
242
|
def debug(progname = nil, &block)
|
190
243
|
add(Logger::DEBUG, nil, progname, &block)
|
191
244
|
end
|
192
245
|
|
246
|
+
# Log an INFO message to the current logger and component.
|
247
|
+
#
|
193
248
|
def info(progname = nil, &block)
|
194
249
|
add(Logger::INFO, nil, progname, &block)
|
195
250
|
end
|
196
251
|
|
252
|
+
# Log a WARN message to the current logger and component.
|
253
|
+
#
|
197
254
|
def warn(progname = nil, &block)
|
198
255
|
add(Logger::WARN, nil, progname, &block)
|
199
256
|
end
|
200
257
|
|
258
|
+
# Log an ERROR message to the current logger and component.
|
259
|
+
#
|
201
260
|
def error(progname = nil, &block)
|
202
261
|
add(Logger::ERROR, nil, progname, &block)
|
203
262
|
end
|
204
263
|
|
264
|
+
# Log a FATAL message to the current logger and component.
|
265
|
+
#
|
205
266
|
def fatal(progname = nil, &block)
|
206
267
|
add(Logger::FATAL, nil, progname, &block)
|
207
268
|
end
|
208
269
|
|
270
|
+
# Log an UNKNOWN message to the current logger and component.
|
271
|
+
# UNKNOWN is more severe than FATAL.
|
272
|
+
#
|
209
273
|
def unknown(progname = nil, &block)
|
210
274
|
add(Logger::UNKNOWN, nil, progname, &block)
|
211
275
|
end
|
data/lib/highlogger/version.rb
CHANGED
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>highlogger</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/highlogger"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/highlogger" class="numbers">0.0.
|
36
|
+
<a href="http://rubyforge.org/projects/highlogger" class="numbers">0.0.2</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘highlogger’</h1>
|
39
39
|
|
@@ -140,7 +140,7 @@ questions about HighLogger.</p>
|
|
140
140
|
|
141
141
|
<p>Comments are welcome. Send email to <a href="mailto:angelbob@nospam.users.sourceforge.net">Noah Gibbs</a></p>
|
142
142
|
<p class="coda">
|
143
|
-
<a href="
|
143
|
+
<a href="angelbob@nospam.users.sourceforge.net">Noah Gibbs</a>, 23rd October 2007<br>
|
144
144
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
145
145
|
</p>
|
146
146
|
</div>
|
metadata
CHANGED
@@ -3,13 +3,13 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: highlogger
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-10-
|
6
|
+
version: 0.0.3
|
7
|
+
date: 2007-10-29 00:00:00 -07:00
|
8
8
|
summary: A heirarchical component-based logging system
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: angelbob@nospam.users.sourceforge.net
|
12
|
-
homepage: http://ab-ext.rubyforge.org
|
12
|
+
homepage: http://ab-ext.rubyforge.org/highlogger
|
13
13
|
rubyforge_project: ab-ext
|
14
14
|
description: A heirarchical component-based logging system
|
15
15
|
autorequire:
|