loggability 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +41 -9353
- data/History.rdoc +6 -1
- data/README.rdoc +26 -10
- data/lib/loggability/formatter/html.rb +7 -0
- data/lib/loggability.rb +2 -2
- data/spec/lib/helpers.rb +0 -2
- data/spec/loggability/formatter/html_spec.rb +11 -4
- data.tar.gz.sig +2 -4
- metadata +11 -7
- metadata.gz.sig +0 -0
data/History.rdoc
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
== v0.0.
|
1
|
+
== v0.0.2 [2012-05-07] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Fix escaping of the 'progname' in the HTML formatter.
|
4
|
+
|
5
|
+
|
6
|
+
== v0.0.1 [2012-05-06] Michael Granger <ged@FaerieMUD.org>
|
2
7
|
|
3
8
|
First release.
|
4
9
|
|
data/README.rdoc
CHANGED
@@ -16,17 +16,33 @@ severity, and in which format.
|
|
16
16
|
|
17
17
|
An example:
|
18
18
|
|
19
|
-
# Load a bunch of libraries
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
# Load a bunch of libraries that use Loggability
|
20
|
+
require 'strelka'
|
21
|
+
require 'inversion'
|
22
|
+
require 'treequel'
|
23
|
+
require 'loggability'
|
24
|
+
|
25
|
+
# Set up our own library
|
26
|
+
module MyProject
|
27
|
+
extend Loggability
|
28
|
+
log_as :my_project
|
29
|
+
|
30
|
+
class Server
|
31
|
+
extend Loggability
|
32
|
+
log_to :my_project
|
33
|
+
|
34
|
+
def initialize
|
35
|
+
self.log.debug "Listening."
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
25
41
|
# Now tell everything that's using Loggability to log to an HTML
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
42
|
+
# log file at INFO level
|
43
|
+
Loggability.write_to( '/usr/local/www/htdocs/log.html' )
|
44
|
+
Loggability.format_as( :html )
|
45
|
+
Loggability.level = :info
|
30
46
|
|
31
47
|
|
32
48
|
== Prerequisites
|
@@ -39,6 +39,12 @@ class Loggability::Formatter::HTML < Loggability::Formatter
|
|
39
39
|
end
|
40
40
|
|
41
41
|
|
42
|
+
### Format the +message+; Overridden to escape the +progname+.
|
43
|
+
def call( severity, time, progname, message )
|
44
|
+
super( severity, time, escape_html(progname), message )
|
45
|
+
end
|
46
|
+
|
47
|
+
|
42
48
|
#########
|
43
49
|
protected
|
44
50
|
#########
|
@@ -66,6 +72,7 @@ class Loggability::Formatter::HTML < Loggability::Formatter
|
|
66
72
|
|
67
73
|
### Escape any HTML special characters in +string+.
|
68
74
|
def escape_html( string )
|
75
|
+
return string unless string.respond_to?( :gsub )
|
69
76
|
return string.
|
70
77
|
gsub( '&', '&' ).
|
71
78
|
gsub( '<', '<' ).
|
data/lib/loggability.rb
CHANGED
@@ -10,10 +10,10 @@ require 'date'
|
|
10
10
|
module Loggability
|
11
11
|
|
12
12
|
# Package version constant
|
13
|
-
VERSION = '0.0.
|
13
|
+
VERSION = '0.0.2'
|
14
14
|
|
15
15
|
# VCS revision
|
16
|
-
REVISION = %q$Revision:
|
16
|
+
REVISION = %q$Revision: 1099204b229f $
|
17
17
|
|
18
18
|
# The key for the global logger (Loggability's own logger)
|
19
19
|
GLOBAL_KEY = :__global__
|
data/spec/lib/helpers.rb
CHANGED
@@ -19,8 +19,8 @@ describe Loggability::Formatter::HTML do
|
|
19
19
|
subject { described_class.new }
|
20
20
|
|
21
21
|
it "formats messages as HTML" do
|
22
|
-
subject.call( 'INFO', Time.at(1336286481), nil, "Foom." ).
|
23
|
-
%r{<span class="log-message-text">Foom.</span>}i
|
22
|
+
subject.call( 'INFO', Time.at(1336286481), nil, "Foom." ).
|
23
|
+
should =~ %r{<span class="log-message-text">Foom.</span>}i
|
24
24
|
end
|
25
25
|
|
26
26
|
it "formats exceptions into useful messages" do
|
@@ -38,8 +38,15 @@ describe Loggability::Formatter::HTML do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "formats regular objects into useful messages" do
|
41
|
-
subject.call( 'INFO', Time.at(1336286481), nil, Object.new ).
|
42
|
-
%r{<span class=\"log-message-text\">#<Object:0x\p{XDigit}+></span>}
|
41
|
+
subject.call( 'INFO', Time.at(1336286481), nil, Object.new ).
|
42
|
+
should =~ %r{<span class=\"log-message-text\">#<Object:0x\p{XDigit}+></span>}
|
43
43
|
end
|
44
|
+
|
45
|
+
it "escapes the 'progname' part of log messages" do
|
46
|
+
progname = "#<Class:0x007f9efa153d08>:0x7f9efa153c18"
|
47
|
+
subject.call( 'DEBUG', Time.at(1336286481), progname, Object.new ).
|
48
|
+
should =~ %r{#<Class:0x0}
|
49
|
+
end
|
50
|
+
|
44
51
|
end
|
45
52
|
|
data.tar.gz.sig
CHANGED
@@ -1,4 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
&̿�!�����]��� ��\3F�[�4���ݬ�m�7�;rw�{y� �Aӧ"��bNQ�]���
|
4
|
-
:2T���av]'hu������&
|
1
|
+
_���E��O���p7��.t�"�M0z�M�U���@��*WZJLI��#4-l[~�˩l�H(�u��:gP�n+��f��ۜ|�{M+�k��u��l����.��eʔ�lzX���B��.�<�ʳ�C<��h�Q�2g#
|
2
|
+
��ss�Y�7
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loggability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
|
37
37
|
Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
|
38
38
|
cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
39
|
-
date: 2012-05-
|
39
|
+
date: 2012-05-07 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pluginfactory
|
@@ -153,11 +153,15 @@ dependencies:
|
|
153
153
|
description: ! "A composable logging system built on the standard Logger library.\n\nYou
|
154
154
|
can add Loggability to large libraries and systems, then hook everything\nup later
|
155
155
|
when you know where you want logs to be written, at what level of\nseverity, and
|
156
|
-
in which format.\n\nAn example:\n\n # Load a bunch of libraries
|
157
|
-
'
|
158
|
-
|
159
|
-
|
160
|
-
|
156
|
+
in which format.\n\nAn example:\n\n # Load a bunch of libraries that use Loggability\n
|
157
|
+
\ require 'strelka'\n require 'inversion'\n require 'treequel'\n require
|
158
|
+
'loggability'\n \n # Set up our own library\n module MyProject\n extend
|
159
|
+
Loggability\n log_as :my_project\n \n class Server\n extend
|
160
|
+
Loggability\n log_to :my_project\n \n def initialize\n
|
161
|
+
\ self.log.debug \"Listening.\"\n end\n end\n \n
|
162
|
+
\ end\n \n # Now tell everything that's using Loggability to log to an HTML\n
|
163
|
+
\ # log file at INFO level\n Loggability.write_to( '/usr/local/www/htdocs/log.html'
|
164
|
+
)\n Loggability.format_as( :html )\n Loggability.level = :info"
|
161
165
|
email:
|
162
166
|
- ged@FaerieMUD.org
|
163
167
|
executables:
|
metadata.gz.sig
CHANGED
Binary file
|