Class: Main::Logger
Overview
because active_record fubars the hell out of Logger ;-(
Defined Under Namespace
Modules: OnOff
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) device
- - (Object) format_message(severity, datetime, progname, msg)
- - (Object) off
- - (Object) off!
- - (Object) on
- - (Object) on!
- - (Boolean) tty?
- - (Object) turn(which)
Class Method Details
+ (Object) new(*a, &b)
4 5 6 |
# File 'lib/main/logger.rb', line 4 def self.new *a, &b super(*a, &b).instance_eval{ @default_formatter = @formatter = Formatter.new; self } end |
+ (Object) off(*a, &b)
36 37 38 |
# File 'lib/main/logger.rb', line 36 def self.off *a, &b new(*a, &b).instance_eval{ turn :off; self } end |
+ (Object) on(*a, &b)
28 29 30 |
# File 'lib/main/logger.rb', line 28 def self.on *a, &b new(*a, &b).instance_eval{ turn :on; self } end |
Instance Method Details
- (Object) device
11 12 13 |
# File 'lib/main/logger.rb', line 11 def device @logdev.instance_eval{ @dev } end |
- (Object) format_message(severity, datetime, progname, msg)
7 8 9 |
# File 'lib/main/logger.rb', line 7 def (severity, datetime, progname, msg) (@formatter || @default_formatter).call(severity, datetime, progname, msg) end |
- (Object) off
32 33 34 |
# File 'lib/main/logger.rb', line 32 def off turn :off end |
- (Object) off!
35 36 37 |
# File 'lib/main/logger.rb', line 35 def off turn :off end |
- (Object) on
24 25 26 |
# File 'lib/main/logger.rb', line 24 def on turn :on end |
- (Object) on!
27 28 29 |
# File 'lib/main/logger.rb', line 27 def on turn :on end |
- (Boolean) tty?
15 16 17 |
# File 'lib/main/logger.rb', line 15 def tty? device.respond_to?('tty?') and device.tty? end |
- (Object) turn(which)
19 20 21 22 |
# File 'lib/main/logger.rb', line 19 def turn which @logdev.extend OnOff unless OnOff === @logdev @logdev.turn which end |