class SemanticLogger::Appender::Loki
def batch(logs)
def batch(logs) message = formatter.batch(logs, self) logger.trace(message) post(message) end
def initialize(url: nil,
Example: https://logs-prod-999.grafana.net
Define the loki instance URL.
url: [String]
Default: SemanticLogger.application
Name of this application to send as a dimension.
application: [String]
Default: SemanticLogger.host
Name of this host to send as a dimension.
host: [String]
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]
Parameters:
Create Grafana Loki appender.
def initialize(url: nil, formatter: SemanticLogger::Formatters::Loki.new, header: {"Content-Type" => "application/json"}, path: INGESTION_PATH, **args, &block) super(url: "#{url}/#{path}", formatter: formatter, header: header, **args, &block) end
def log(log)
def log(log) message = formatter.call(log, self) puts message logger.trace(message) post(message) end