Class: VidazingLogger::Logger
- Inherits:
-
Object
- Object
- VidazingLogger::Logger
- Defined in:
- lib/vidazing_logger/logger.rb
Overview
Core Logger
class api. Calling build
returns a logger with 4 Appenders attached.
Instance Attribute Summary collapse
-
#log_dir ⇒ String
readonly
Where to write logs to.
-
#name ⇒ String
readonly
Use in Logging.logger.
Instance Method Summary collapse
-
#build ⇒ Logging.logger
Create a Logger with 4 Appenders.
-
#clean ⇒ Object
Deletes the
log_dir
directory. -
#initialize(log_dir = VidazingLogger::LOG_DIR, name:) ⇒ Logger
constructor
Creates the ‘logs/’ directory.
Constructor Details
#initialize(log_dir = VidazingLogger::LOG_DIR, name:) ⇒ Logger
Creates the ‘logs/’ directory
25 26 27 28 29 30 |
# File 'lib/vidazing_logger/logger.rb', line 25 def initialize(log_dir = VidazingLogger::LOG_DIR, name:) @name = name @log_dir = log_dir create_log_dir end |
Instance Attribute Details
#log_dir ⇒ String (readonly)
Where to write logs to
14 15 16 |
# File 'lib/vidazing_logger/logger.rb', line 14 def log_dir @log_dir end |
#name ⇒ String (readonly)
Use in Logging.logger
19 20 21 |
# File 'lib/vidazing_logger/logger.rb', line 19 def name @name end |
Instance Method Details
#build ⇒ Logging.logger
Create a Logger with 4 Appenders. STDERR + ‘logs/error.log’ STDOUT + ‘logs/build.log’
42 43 44 45 46 47 48 49 50 |
# File 'lib/vidazing_logger/logger.rb', line 42 def build LoggerBuilder.build(name: @name) do |builder| builder .add_stdout .add_build_log(log_dir: @log_dir) .add_stderr .add_error_log(log_dir: @log_dir) end end |
#clean ⇒ Object
Deletes the log_dir
directory
33 34 35 |
# File 'lib/vidazing_logger/logger.rb', line 33 def clean FileUtils.remove_dir(@log_dir, true) end |