Class: Lescopr::Monitoring::Logger
- Inherits:
-
Object
- Object
- Lescopr::Monitoring::Logger
- Defined in:
- lib/lescopr/monitoring/logger.rb
Overview
Internal SDK logger — writes to .lescopr.log, never pollutes app output.
Constant Summary collapse
- LOG_FILE =
".lescopr.log"- MAX_SIZE =
5 MB
5 * 1024 * 1024
- MAX_FILES =
3
Instance Method Summary collapse
- #debug(msg) ⇒ Object
- #error(msg) ⇒ Object
- #fatal(msg) ⇒ Object
- #info(msg) ⇒ Object
-
#initialize(debug: false) ⇒ Logger
constructor
A new instance of Logger.
- #warn(msg) ⇒ Object
Constructor Details
#initialize(debug: false) ⇒ Logger
Returns a new instance of Logger.
13 14 15 16 |
# File 'lib/lescopr/monitoring/logger.rb', line 13 def initialize(debug: false) @debug = debug @logger = build_logger end |
Instance Method Details
#debug(msg) ⇒ Object
18 19 20 |
# File 'lib/lescopr/monitoring/logger.rb', line 18 def debug(msg) @logger.debug(format_msg(msg)) if @debug end |
#error(msg) ⇒ Object
30 31 32 |
# File 'lib/lescopr/monitoring/logger.rb', line 30 def error(msg) @logger.error(format_msg(msg)) end |
#fatal(msg) ⇒ Object
34 35 36 |
# File 'lib/lescopr/monitoring/logger.rb', line 34 def fatal(msg) @logger.fatal(format_msg(msg)) end |
#info(msg) ⇒ Object
22 23 24 |
# File 'lib/lescopr/monitoring/logger.rb', line 22 def info(msg) @logger.info(format_msg(msg)) end |
#warn(msg) ⇒ Object
26 27 28 |
# File 'lib/lescopr/monitoring/logger.rb', line 26 def warn(msg) @logger.warn(format_msg(msg)) end |