module PlaceOS::LogBackend

Defined in:

placeos-log-backend.cr
placeos-log-backend/format.cr
placeos-log-backend/telemetry.cr

Constant Summary

Log = ::Log.for(self)
STDOUT = ActionController.default_backend

Class Method Summary

Class Method Detail

def self.configure_opentelemetry(service_name : String, service_version : String, endpoint : String | Nil = OTEL_EXPORTER_OTLP_ENDPOINT, header_environment : String | Nil = OTEL_EXPORTER_OTLP_HEADERS, otel_key : String | Nil = OTEL_EXPORTER_OTLP_API_KEY, new_relic_key : String | Nil = NEW_RELIC_LICENSE_KEY, elastic_apm_key : String | Nil = ELASTIC_APM_API_KEY) : Nil #

Call this method to configure OpenTelemetry.

The client will not initialize if the OTEL_EXPORTER_OTLP_ENDPOINT environment variable is not present.

Usage

PlaceOS::LogBackend.configure_opentelemetry(
  service_name: APP_NAME,
  service_version: VERSION,
)

Environment

OTLP configuration

Api Keys


[View source]
def self.log_backend(udp_log_host : String | Nil = UDP_LOG_HOST, udp_log_port : Int32 | Nil = UDP_LOG_PORT, default_backend : ::Log::IOBackend = ActionController.default_backend, format : Format = LOG_FORMAT) #

[View source]
def self.register_severity_switch_signals(production : Bool, namespaces : Array(String), default : ::Log::Severity = ::Log::Severity::Info, backend = self.log_backend) : Nil #

Registers callbacks for USR1 and USR2

USR1 toggles :trace for all Log instances namespaces's Logs to :info if production is true, otherwise it is set to :debug. Log's not registered under namespaces are toggled to default

Usage

  • $ kill -USR1 ${the_application_pid}

[View source]
def self.trace : Bool #

[View source]
def self.trace_logging(enabled : Bool, production : Bool, namespaces : Array(String), default : ::Log::Severity, backend) #

Hook to toggle Log instances' :trace severity

enabled

  • true :trace for all Log instances.

  • false returns namespaces's Logs to :info if production is true and otherwise it is set to :debug. Log's that are not registered under namespaces are toggled to default.


[View source]