module SemanticLogger

def self.add_appender(**args, &block)

logger.debug("Login time", user: 'Joe', duration: 100, ip_address: '127.0.0.1')
logger.info "Hello World"
logger = SemanticLogger['Example']

SemanticLogger.add_appender(logger: log)
SemanticLogger.default_level = :debug

log.level = Logger::DEBUG
log = Logger.new($stdout)
# Built-in Ruby logger

require 'semantic_logger'
require 'logger'
# Send Semantic logging output to an existing logger

Log to log4r, Logger, etc.:

SemanticLogger.add_appender(io: $stdout, level: :info)
SemanticLogger.add_appender(file_name: 'logfile.log')
# Send all logging output to a file and only :info and above to standard output

SemanticLogger.add_appender(file_name: 'logfile.log')
# Send all logging output to a file

SemanticLogger.add_appender(io: $stdout)
# Send all logging output to Standard Out (Screen)

Examples:

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: :default
A Proc to be used to format the output from this appender
Or,
An instance of a class that implements #call
Or,
Any of the following symbol values: :default, :color, :json, :logfmt, etc...
formatter: [Symbol|Object|Proc]

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

An instance of a Logger or a Log4r logger.
logger: [Logger|Log4r]
Or,

SemanticLogger::Appender::Http.new(url: 'http://localhost:8088/path')
For example:
An instance of an appender derived from SemanticLogger::Subscriber
Or,
:bugsnag, :elasticsearch, :graylog, :http, :mongodb, :new_relic, :splunk_http, :syslog, :wrapper
For example:
A symbol identifying the appender to create.
appender: [Symbol|SemanticLogger::Subscriber]
Or,

For example $stdout, $stderr, etc.
An IO Stream to log to.
io: [IO]
Or,

File name to write log messages to.
file_name: [String]
Parameters

more information on custom formatters
of the messages sent to that appender. See SemanticLogger::Logger.new for
If a block is supplied then it will be used to customize the format

Appenders will be written to in the order that they are added

emitted from Semantic Logger
Add a new logging appender as a new destination for all log messages
def self.add_appender(**args, &block)
  appender = appenders.add(**args, &block)
  # Start appender thread if it is not already running
  Logger.processor.start
  appender
end