Class: Bj::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 (also: #off!)
- - (Object) on (also: #on!)
- - (Boolean) tty?
- - (Object) turn(which)
Class Method Details
+ (Object) new(*a, &b)
3 4 5 |
# File 'lib/bj/logger.rb', line 3 def self.new *a, &b super(*a, &b).instance_eval{ @default_formatter = @formatter = Formatter.new; self } end |
+ (Object) off(*a, &b)
46 47 48 |
# File 'lib/bj/logger.rb', line 46 def self.off *a, &b new(*a, &b).instance_eval{ turn :off; self } end |
+ (Object) on(*a, &b)
38 39 40 |
# File 'lib/bj/logger.rb', line 38 def self.on *a, &b new(*a, &b).instance_eval{ turn :on; self } end |
Instance Method Details
- (Object) device
10 11 12 |
# File 'lib/bj/logger.rb', line 10 def device @logdev.instance_eval{ @dev } end |
- (Object) format_message(severity, datetime, progname, msg)
6 7 8 |
# File 'lib/bj/logger.rb', line 6 def (severity, datetime, progname, msg) (@formatter || @default_formatter).call(severity, datetime, progname, msg) end |
- (Object) off Also known as: off!
42 43 44 |
# File 'lib/bj/logger.rb', line 42 def off turn :off end |
- (Object) on Also known as: on!
34 35 36 |
# File 'lib/bj/logger.rb', line 34 def on turn :on end |
- (Boolean) tty?
14 15 16 |
# File 'lib/bj/logger.rb', line 14 def tty? device.respond_to?('tty?') and device.tty? end |
- (Object) turn(which)
18 19 20 21 |
# File 'lib/bj/logger.rb', line 18 def turn which @logdev.extend OnOff unless OnOff === @logdev @logdev.turn which end |