Crates.io | bp3d-logger |
lib.rs | bp3d-logger |
version | 2.0.0-rc.3.0.0 |
source | src |
created_at | 2022-03-04 13:50:39.300186 |
updated_at | 2024-07-20 16:47:41.053318 |
description | A flexible Log implementation intended to be used with BP3D software. |
homepage | |
repository | https://github.com/BlockProject3D/debug.tracing |
max_upload_size | |
id | 543521 |
size | 59,083 |
This repository contains the main implementation of bp3d-debug as well as all needed support tools. This is the official implementation of bp3d-debug for use within all BP3D software.
A flexible log system intended to be used with BP3D software.
This crate contains the actual implementation for bp3d-debug. 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 |