Class: Ductr::Log::FileOutput
- Inherits:
-
StandardOutput
- Object
- StandardOutput
- Ductr::Log::FileOutput
- Defined in:
- lib/ductr/log/outputs/file_output.rb
Overview
An output to write logs in a file
Constant Summary
Constants inherited from StandardOutput
StandardOutput::SEVERITY_LABELS
Instance Method Summary collapse
-
#initialize(formatter, path:, **options) ⇒ FileOutput
constructor
Creates the output with the given formatter, path and options.
Methods inherited from StandardOutput
Constructor Details
#initialize(formatter, path:, **options) ⇒ FileOutput
Creates the output with the given formatter, path and options
20 21 22 23 24 25 26 27 |
# File 'lib/ductr/log/outputs/file_output.rb', line 20 def initialize(formatter, path:, **) # rubocop:disable Lint/MissingSuper dir = File.dirname(path) FileUtils.mkdir_p(dir) unless File.directory?(dir) File.new(path, "w") unless File.exist?(path) @formatter = formatter.new @log_device = ::Logger::LogDevice.new path, ** end |