lib/loggability/formatter/html.rb in loggability-0.0.1 vs lib/loggability/formatter/html.rb in loggability-0.0.2
- old
+ new
@@ -37,10 +37,16 @@
def initialize( format=HTML_LOG_FORMAT ) # :notnew:
super
end
+ ### Format the +message+; Overridden to escape the +progname+.
+ def call( severity, time, progname, message )
+ super( severity, time, escape_html(progname), message )
+ end
+
+
#########
protected
#########
### Format the specified +object+ for output to the log.
@@ -64,9 +70,10 @@
private
#######
### Escape any HTML special characters in +string+.
def escape_html( string )
+ return string unless string.respond_to?( :gsub )
return string.
gsub( '&', '&' ).
gsub( '<', '<' ).
gsub( '>', '>' )
end