lib/loggability/logger.rb in loggability-0.1.0 vs lib/loggability/logger.rb in loggability-0.2.0

- old
+ new

@@ -31,10 +31,19 @@ ### Create a new AppendingLogDevice that will append content to +array+. def initialize( target ) @target = target end + + ###### + public + ###### + + # The target of the log device + attr_reader :target + + ### Append the specified +message+ to the target. def write( message ) @target << message end @@ -125,9 +134,27 @@ ###### public ###### + + ### Return a human-readable representation of the object suitable for debugging. + def inspect + dev = if self.logdev.respond_to?( :dev ) + self.logdev.dev.class + else + self.logdev.target.class + end + + return "#<%p:%#x severity: %s, formatter: %s, outputting to: %p>" % [ + self.class, + self.object_id * 2, + self.level, + self.formatter.class.name.sub( /.*::/, '' ).downcase, + dev, + ] + end + # # :section: Severity Level #