Class: Pantheios::Services::SimpleConsoleLogService
- Inherits:
-
Object
- Object
- Pantheios::Services::SimpleConsoleLogService
- Defined in:
- lib/pantheios/services/simple_console_log_service.rb
Overview
A class that fulfils the Pantheios LogService protocol that allows all severities and logs to the console (via $stdout and $stderr)
NOTE: The LogService protocol is implemented by a class that provides the instance methods severity_logged?(severity : Object) : boolean and log(severity : Object, t : Time, prefix : String|Array, msg : String)
Instance Method Summary collapse
-
#infer_stream(sev) ⇒ Object
Overrideable method that determines which stream to write, based on a severity.
- #log(sev, t, pref, msg) ⇒ Object
- #severity_logged?(severity) ⇒ Boolean
Instance Method Details
#infer_stream(sev) ⇒ Object
Overrideable method that determines which stream to write, based on a severity. This implementation always returns $stderr
Overrides must return an object that supports the puts(String) method
80 81 82 83 |
# File 'lib/pantheios/services/simple_console_log_service.rb', line 80 def infer_stream sev $stderr end |
#log(sev, t, pref, msg) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/pantheios/services/simple_console_log_service.rb', line 68 def log sev, t, pref, msg stm = infer_stream sev stm.puts "#{pref}#{msg}" end |
#severity_logged?(severity) ⇒ Boolean
63 64 65 66 |
# File 'lib/pantheios/services/simple_console_log_service.rb', line 63 def severity_logged? severity true end |