Class: Ella::Log
- Inherits:
-
Object
- Object
- Ella::Log
- Defined in:
- lib/ella/log.rb
Overview
A convenient minor reworking of Ruby’s logger.
Class Method Summary collapse
- .create(message) ⇒ Object
- .debug(message) ⇒ Object
- .destroy(message) ⇒ Object
-
.error(message) ⇒ Object
The first three methods do not have timestamps and may be colour coded.
- .exit_message(message) ⇒ Object
- .fatal(message) ⇒ Object
- .info(message) ⇒ Object
- .log_error ⇒ Object
- .log_info ⇒ Object
- .newline ⇒ Object
-
.say(message) ⇒ Object
Misc.
- .unknown(message) ⇒ Object
- .warn(message) ⇒ Object
- .yell(message) ⇒ Object
Class Method Details
.create(message) ⇒ Object
52 53 54 55 |
# File 'lib/ella/log.rb', line 52 def self.create() output_str = ' ' * 8 + 'CREATE '.green.bold + say(output_str) end |
.debug(message) ⇒ Object
48 49 50 |
# File 'lib/ella/log.rb', line 48 def self.debug() log_info.info() end |
.destroy(message) ⇒ Object
57 58 59 60 |
# File 'lib/ella/log.rb', line 57 def self.destroy() output_str = ' ' * 8 + 'DESTROY '.red.bold + say(output_str) end |
.error(message) ⇒ Object
The first three methods do not have timestamps and may be colour coded. They should not be anything less trivial than a heads up for the user.
11 12 13 |
# File 'lib/ella/log.rb', line 11 def self.error() say('ERROR: '.red + .bold) end |
.exit_message(message) ⇒ Object
27 28 29 |
# File 'lib/ella/log.rb', line 27 def self.() say(.bold.yellow) end |
.fatal(message) ⇒ Object
40 41 42 |
# File 'lib/ella/log.rb', line 40 def self.fatal() say('FATAL: '.red + .bold) end |
.info(message) ⇒ Object
19 20 21 |
# File 'lib/ella/log.rb', line 19 def self.info() say(" ELLA: ".bold.blue + .split(' ').map(&:capitalize).join(' ').bold) end |
.log_error ⇒ Object
66 67 68 |
# File 'lib/ella/log.rb', line 66 def self.log_error Logger.new(STDERR) end |
.log_info ⇒ Object
62 63 64 |
# File 'lib/ella/log.rb', line 62 def self.log_info Logger.new(STDOUT) end |
.newline ⇒ Object
15 16 17 |
# File 'lib/ella/log.rb', line 15 def self.newline say("\n") end |
.say(message) ⇒ Object
Misc. It would be best to phase this out in the long run.
32 33 34 |
# File 'lib/ella/log.rb', line 32 def self.say() puts end |
.unknown(message) ⇒ Object
36 37 38 |
# File 'lib/ella/log.rb', line 36 def self.unknown() log_error.unknown() end |
.warn(message) ⇒ Object
44 45 46 |
# File 'lib/ella/log.rb', line 44 def self.warn() log_info.warn() end |
.yell(message) ⇒ Object
23 24 25 |
# File 'lib/ella/log.rb', line 23 def self.yell() say(.bold.blue) end |