Class: Kamal::Output::FileLogger

Inherits:
BaseLogger
  • Object
show all
Defined in:
lib/kamal/output/file_logger.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:) ⇒ FileLogger

Returns a new instance of FileLogger.



9
10
11
12
# File 'lib/kamal/output/file_logger.rb', line 9

def initialize(path:)
  @path = Pathname.new(path)
  super()
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



2
3
4
# File 'lib/kamal/output/file_logger.rb', line 2

def path
  @path
end

Class Method Details

.build(settings:, config:) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
7
# File 'lib/kamal/output/file_logger.rb', line 4

def self.build(settings:, config:)
  raise ArgumentError, "file path is required" unless settings["path"]
  new(path: settings["path"])
end

Instance Method Details

#<<(message) ⇒ Object



14
15
16
# File 'lib/kamal/output/file_logger.rb', line 14

def <<(message)
  @file&.print(message)
end