module PlaceOS::LogBackend
Defined in:
placeos-log-backend.crplaceos-log-backend/format.cr
placeos-log-backend/telemetry.cr
Constant Summary
-
Log =
::Log.for(self)
-
STDOUT =
ActionController.default_backend
Class Method Summary
-
.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.
- .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)
-
.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
- .trace : Bool
- .trace_logging(enabled : Bool, production : Bool, namespaces : Array(String), default : ::Log::Severity, backend)
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
OTEL_EXPORTER_OTLP_ENDPOINT
OTEL_EXPORTER_OTLP_HEADERS
: e.gHello=world,Foo=bar
Api Keys
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)
#
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 Log
s 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}