Crates.io | bp3d-tracing |
lib.rs | bp3d-tracing |
version | 1.0.0-alpha-2.0.0 |
source | src |
created_at | 2022-04-25 14:31:33.123563 |
updated_at | 2022-04-27 19:39:05.608357 |
description | Tracing subscriber implementations for use with BP3D software. Supports traditional logging through bp3d-logger and supports remote profiling through TCP. |
homepage | |
repository | https://gitlab.com/bp3d/tracing/tracing |
max_upload_size | |
id | 573897 |
size | 76,692 |
Implementations of tracing
Subscriber for use with
BP3D software. Supports traditional logging through bp3d-logger and supports remote profiling through TCP.
This crate is currently highly experimental and may not work on all systems. Currently, this is fully tested on
macOS 12.3.1
only. It may work on other unix
systems.
Additionally, this is currently broken on Windows
systems.
fn main() {
let _guard = bp3d_tracing::initialize("my-application");
//Application code using `tracing` or `log` utilities.
}
NOTE: this library uses threads to perform logging and profiling. As such you shouldn't call std::process::exit()
without first dropping the _guard
guard variable. Failing to do so will result in truncated logs with the logger
backend and data loss with the profiler backend.
To configure the behavior of bp3d-tracing
some environment variables are used:
Name | Type | Possible values | Behavior | Default |
---|---|---|---|---|
PROFILER | boolean | 1, 0, true, false, on, off | Enables remote profiling. | off |
LOG | enum | trace, debug, info, warning, error | Maximum log level for logger backend. | info |
LOG_DISABLE | boolean | 1, 0, true, false, on, off | Disables the logger backend. | off |
LOG_STDOUT | boolean | 1, 0, true, false, on, off | Always print log messages to stdout. | off |
LOG_COLOR | boolean | 1, 0, true, false, on, off | Enables color output. | isatty |
On systems where configuring environment variables is not expected or too complicated, this library supports bp3d-env
.
bp3d-env
supports loading files as fallback to environment variables. This library appends the following default path
to bp3d-env
bp3d-fs::App::new("my-application").get_documents()?.join("environment")
which corresponds to the
following paths:
OS | Path |
---|---|
macOS | ~/Library/Application Support/my-application/Documents/environment |
Linux | ~/.local/share/my-application/Documents/environment |
Windows | %APPDATA%/my-application/Documents/environment |
iOS | Files App/my-application/environment |