Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
🌲 Timber Rust
🚀 Overview
Timber Rust is designed to provide a seamless integration for system logs and telemetry. It focuses on performance and type-safety, allowing developers to switch between different observability backends with minimal configuration.
✨ Key Features
- Blazing Fast: Zero-cost abstractions following the Rust philosophy.
- Pluggable Backends: Support for multiple services (e.g., Loki) via feature flags.
- Secure by Default: Automatic vulnerability scanning and license compliance.
- Docs-First: Comprehensive API documentation integrated with GitHub Pages.
📖 Documentation
Full technical documentation, including API references and module usage, is available at our GitHub Pages site.
📦 Installation
Add this to your Cargo.toml:
[]
= { = "[https://github.com/dante19031999/timber-rust](https://github.com/dante19031999/timber-rust)" }
🚀 How to get started
Logging into stdout/stderr
use LoggerFactory;
use LogLevel;
// An async logger over stdout/stderr (1 worker)
let logger_stdout = queued_cout;
let logger_stderr = queued_cerr;
// Log something
logger_stdout.log;
logger_stderr.log;
- See: [
service::StandardCoutWrite] - See: [
service::StandardCerrWrite]
Logging into a file
use LoggerFactory;
use LogLevel;
use OpenOptions;
let mut file = new
.write // Write
.append // Append (not squash previous logs)
.create // Create if not exits
.open.expect;
// An async logger over a file (1 worker)
let logger = queued_file;
// Log something
logger.log;
logger.log;
# let _ = remove_file;
- See: [
service::StandardFileWrite]
Logging into loki
#
use LokiConfig;
use LoggerFactory;
use LogLevel;
#
let mut config = new;
// An async batched loki logger
#
let logger = loki;
// Log something
#
logger.log;
#
logger.log;
- See: [
LokiLogger] - See: [
LokiConfig][service::LokiConfig]
Creating your own custom loggers
The library uses two main logger models:
- [
DirectLogger]: A sync logger. Blocks until the process is finished. - [
QueuedLogger]: An async logger. Uses a crossbeam internal queue to dispatch logs. - Both options use a [
Service] as a backend. You may check or inbuilt [services][service]. You may build your own implementing the trait [Service][crate::Service]. - [
LokiLogger]: An specific batched logger to loki. Can be customized using a custom [LokiService][crate::service::Loki]. - Don't forget to check first our inbuilt [
LoggerFactory]! - You may directly implement [
LoggerImpl] if you wish to bypass the [service][service] system.
Mutltichanel logging
Our logging system supports multichannel logging through [LogManager].
It is possible to create presets through [Config]. Though it is limited to what can be deduced at runtime.
Our [Config][crate::Config] implements [serde::Serialize] and [serde::Deserialize] for total freedom in congiguration storage.
The examples where built using JSON (the most common), but [serde] allows for any model.
⚖️ Credits & Licensing
This project relies on several open-source crates. You can find the full list of dependencies and their respective licenses in our Credits Report.