class SemanticLogger::Appender::IO

def console_output?

def console_output?
  [$stderr, $stdout].include?(@io)
end

def flush

Waits for all sent documents to be written to disk
Flush all pending logs to disk.
def flush
  @io.flush if @io.respond_to?(:flush)
end

def initialize(io, **args, &block)

logger.info 'Hello World'
logger = SemanticLogger['test']

SemanticLogger.add_appender(io: $stdout, formatter: :color)
# Log to screen

SemanticLogger.default_level = :info
# Enable trace level logging

require "semantic_logger"
Example

The Proc must return true or false.
Proc: Only include log messages where the supplied Proc returns true
regular expression. All other messages will be ignored.
RegExp: Only include log messages where the class name matches the supplied
:filter [Regexp|Proc]

Default: Use the built-in formatter (See: #call)
the output from this appender
An instance of a class that implements #call, or a Proc to be used to format
:formatter: [Object|Proc]

Default: SemanticLogger.default_level
Override the log level for this appender.
:level [:trace | :debug | :info | :warn | :error | :fatal]

An IO stream to which to write the log messages to.
io [IO]
Parameters

Create a Stream Logger appender instance.
def initialize(io, **args, &block)
  @io = io
  unless @io.respond_to?(:write)
    raise(ArgumentError, "SemanticLogging::Appender::IO io is not a valid IO instance: #{io.inspect}")
  end
  super(**args, &block)
end

def log(log)

def log(log)
  # Since only one appender thread will be writing to the file at a time
  # it is not necessary to protect access to the file with a semaphore
  # Allow this logger to filter out log levels lower than it's own
  @io.write(formatter.call(log, self) << "\n")
  true
end