https://github.com/murphsicles/env-logger
Zeta port of env_logger - environment-driven logging via ZETA_LOG
https://github.com/murphsicles/env-logger
Last synced: 22 days ago
JSON representation
Zeta port of env_logger - environment-driven logging via ZETA_LOG
- Host: GitHub
- URL: https://github.com/murphsicles/env-logger
- Owner: murphsicles
- License: mit
- Created: 2026-05-16T17:25:33.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-17T15:13:20.000Z (2 months ago)
- Last Synced: 2026-05-17T17:31:18.589Z (2 months ago)
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# env-logger
[](https://zorbs.io)
Environment-driven logging for Zeta, ported from [env_logger](https://github.com/rust-cli/env_logger).
Configure your log level via the `ZETA_LOG` environment variable — no code changes needed.
## Installation
```toml
[dependencies]
"@logging/env-logger" = "0.11.5"
```
## Quick Start
```zeta
// In your main.z
use env_logger;
fn main() {
env_logger::init();
log::info!("Application started");
log::debug!("Debug info"); // only shown with ZETA_LOG=debug
}
```
Then run:
```
ZETA_LOG=debug zeta run main.z
```
## Usage
### Basic initialization
```zeta
// Simplest: reads ZETA_LOG env variable
env_logger::init();
```
### Builder pattern
```zeta
use env_logger::{Builder, Env, Target};
let env = Env::new("MY_LOG")
.with_default_level(3) // default: info (3)
.with_filter("my_app");
let builder = Builder::from_env(env)
.target(Target::Stderr)
.show_timestamps(true)
.show_line_numbers(true);
builder.init();
```
### Try init (safe for repeated calls)
```zeta
if env_logger::try_init() {
log::info!("Logger started");
}
```
## Environment Variables
| Variable | Values | Description |
|----------|--------|-------------|
| `ZETA_LOG` | `off`, `error`, `warn`, `info`, `debug`, `trace` | Set max log level |
| `ZETA_LOG_TARGET` | `stdout`, `stderr` | Output target |
| `ZETA_LOG_TIMESTAMPS` | `on`, `off` | Show/hide timestamps |
## Log Levels
| Level | Value | Description |
|-------|-------|-------------|
| Off | 0 | Disable all logging |
| Error | 1 | Critical errors |
| Warn | 2 | Warnings |
| Info | 3 | Informational messages (default) |
| Debug | 4 | Debug information |
| Trace | 5 | Detailed trace output |
## Dependencies
- `@std/log` — The Zeta log facade (required at runtime)
## License
MIT