{"id":21133852,"url":"https://github.com/mozgiii/slog-env-cfg","last_synced_at":"2025-07-11T18:13:02.223Z","repository":{"id":52416515,"uuid":"189495411","full_name":"MOZGIII/slog-env-cfg","owner":"MOZGIII","description":"Opinionated slog drains builder, configurable via env vars.","archived":false,"fork":false,"pushed_at":"2021-04-29T20:22:56.000Z","size":40,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T06:56:13.504Z","etag":null,"topics":["slog","slog-rs"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MOZGIII.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-30T23:25:32.000Z","updated_at":"2019-10-24T15:50:45.000Z","dependencies_parsed_at":"2022-09-11T12:52:00.986Z","dependency_job_id":null,"html_url":"https://github.com/MOZGIII/slog-env-cfg","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOZGIII%2Fslog-env-cfg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOZGIII%2Fslog-env-cfg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOZGIII%2Fslog-env-cfg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOZGIII%2Fslog-env-cfg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MOZGIII","download_url":"https://codeload.github.com/MOZGIII/slog-env-cfg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243581060,"owners_count":20314162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["slog","slog-rs"],"created_at":"2024-11-20T06:19:02.533Z","updated_at":"2025-03-14T12:40:45.498Z","avatar_url":"https://github.com/MOZGIII.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slog-env-cfg\n\n[![crates.io](https://img.shields.io/crates/v/slog-env-cfg.svg)](https://crates.io/crates/slog-env-cfg)\n[![docs.rs](https://docs.rs/slog-env-cfg/badge.svg)](https://docs.rs/slog-env-cfg)\n[![Build Status](https://travis-ci.org/MOZGIII/slog-env-cfg.svg?branch=master)](https://travis-ci.org/MOZGIII/slog-env-cfg)\n\nOpinionated slog drains builder, configurable via env vars.\n\n## Description\n\nThis crate builds an [slog `Drain`](https://docs.rs/slog/2/slog/trait.Drain.html) that writes to stdout. It's designed to be easy to use and with sane defaults. The format of the log records is configurable at runtime via `LOG_FORMAT` environment variable.\n\nPossible values for `LOG_FORMAT` are:\n\n- `terminal` (default)\n- `json`\n\nThe idea is that in development environment, where you just run the executable manually and in the absence of centralized logging,\nyou would rely on human-readable log output. At deployment, on the contrary, centralized logging system can make use of JSON-formatted\nlogs, so the `LOG_FORMAT=json` can be set. The configuration is at runtime, so you only need to manage a single build artifact for both\nuse cases.\n\nThis crate aims to be an opinionated solution, and no other configuration is available so far.\nYet, I'm open to adding other tweaks if they're justified.\n\n## Usage\n\nHere's a minimal complete `main.rs` example:\n\n```rust\nuse slog::{info, o};\n\nfn main() {\n    let drain = slog_env_cfg::logger_from_env(o!()).expect(\"initialization error\");\n    info!(root, \"formatted: {}\", 1; \"log-key\" =\u003e true);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozgiii%2Fslog-env-cfg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmozgiii%2Fslog-env-cfg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozgiii%2Fslog-env-cfg/lists"}