Module: RailsLokiExporter

Defined in:
lib/rails_loki_exporter.rb,
lib/rails_loki_exporter/version.rb,
lib/rails_loki_exporter/loki_http_client.rb,
lib/rails_loki_exporter/intercepting_logger.rb,
lib/rails_loki_exporter/custom_log_subscriber.rb

Defined Under Namespace

Classes: CustomLogSubscriber, InterceptingLogger, LokiHttpClient

Constant Summary collapse

VERSION =
'1.0.5'
LOGS_TYPE =
%w(ERROR WARN FATAL INFO DEBUG).freeze

Class Method Summary collapse

Class Method Details

.create_logger(config_file_path) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/rails_loki_exporter.rb', line 8

def create_logger(config_file_path)
  config = load_config(config_file_path)
  client = LokiHttpClient.new(config)
  logger = InterceptingLogger.new(intercept_logs: config['intercept_logs'])
  if config['enable_log_subscriber'] 
    CustomLogSubscriber.client = client
  end
  logger.client = client
  logger
end