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.
Available loggers
- Silent: [
logger::Silent][crate::logger::Silent] (the messages are dropped) - Direct (sync logging): [
logger::Direct][crate::logger::Direct] (uses services) - Queued (async logging): [
logger::Queued][crate::logger::Queued] (uses services) - Loki (batched HTTPS): [
logger::Loki][crate::logger::Loki] (requires featureloki) - CloudWatch (batched HTTPS): [
logger::CloudWatch][crate::logger::CloudWatch] (requires featureaws)
Available services
- Loki (HTTPS): [
service::Loki][crate::service::Loki] (requires featureloki) - ClousWatch (SDK): [
service::CloudWatch][crate::service::CloudWatch] (requires featureaws) - ClousWatch (STDOUT): [
service::CloudWatchCout][crate::service::CloudWatchCout] (requires featureawscout) - Io services: [
service::IoWrite][crate::service::IoWrite]- File: [
service::StandardFileWrite][crate::service::StandardFileWrite] - Buffered file: [
service::StandardBufferedFileWrite][crate::service::StandardBufferedFileWrite] - Boxed writers: [
service::StandardBoxedIoWrite][crate::service::StandardBoxedIoWrite]
- File: [
- Fmt services: [
service::FmtWrite][crate::service::FmtWrite]- String: [
service::StandardStringFmtWrite][crate::service::StandardStringFmtWrite] - Boxed writers: [
service::StandardBoxedFmtWrite][crate::service::StandardBoxedFmtWrite]
- String: [
- Conceptual:
- Vector: [
service::Vector][crate::service::Vector]
- Vector: [
📖 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;
use Concurrency;
// An async logger over stdout/stderr (1 worker)
let logger_stdout = cout.build;
let logger_stderr = cerr.build;
// Log something
logger_stdout.log;
logger_stderr.log;
- See: [
service::StandardCoutWrite] - See: [
service::StandardCerrWrite]
Logging into a file
use LoggerFactory;
use LogLevel;
use Concurrency;
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 = io.file.build;
// 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.config.build;
// 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.