class Patterns::Logger
The standard singleton pattern example - a logger to handle writing to a log file.
Attributes
output[R]
The output that will be written to a log file
Public Class Methods
new()
click to toggle source
Public Instance Methods
error(message, log_file = DEFAULT_LOG_PATH)
click to toggle source
Sets the format of our log message to error and writes data to the log file
-
message
- The message to log
Examples
=> logger.error 'File not found'
# File app/models/singleton/logger.rb, line 34 def error(message, log_file = DEFAULT_LOG_PATH) @output = format(message, 'ERROR') write(log_file) end
info(message, log_file = DEFAULT_LOG_PATH)
click to toggle source
Sets the format of our log message to info and writes data to the log file
-
message
- The message to log
Examples
=> logger.info 'This is some useful info'
# File app/models/singleton/logger.rb, line 46 def info(message, log_file = DEFAULT_LOG_PATH) @output = format(message, 'INFO') write(log_file) end