{"id":16677289,"url":"https://github.com/kernelerr/moe-logger","last_synced_at":"2025-04-09T21:24:01.756Z","repository":{"id":57639860,"uuid":"406399983","full_name":"KernelErr/moe-logger","owner":"KernelErr","description":"A Rust logger with various features.","archived":false,"fork":false,"pushed_at":"2021-09-15T14:23:09.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T22:42:03.911Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KernelErr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-14T14:26:11.000Z","updated_at":"2024-05-18T10:08:22.000Z","dependencies_parsed_at":"2022-09-04T14:02:14.438Z","dependency_job_id":null,"html_url":"https://github.com/KernelErr/moe-logger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernelErr%2Fmoe-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernelErr%2Fmoe-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernelErr%2Fmoe-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernelErr%2Fmoe-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KernelErr","download_url":"https://codeload.github.com/KernelErr/moe-logger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248113231,"owners_count":21049808,"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":[],"created_at":"2024-10-12T13:25:54.245Z","updated_at":"2025-04-09T21:24:01.732Z","avatar_url":"https://github.com/KernelErr.png","language":"Rust","readme":"# Moe Logger\n\n(＞ω＜) Another logger based on [pretty-env-logger](https://github.com/seanmonstar/pretty-env-logger) and [env_logger](https://github.com/env-logger-rs/env_logger/). Allow writing log to file with features like formatting, file rotation.\n\n## Usage\n\nAppend following lines to `Cargo.toml`:\n\n```rust\nlog = \"0.4\"\nmoe_logger = \"0.2\"\n```\n\nThere's an example:\n\n```rust\nuse log::{info, warn, error, debug};\nuse moe_logger::LogConfig;\n\nfn main() {\n    let log_config = LogConfig::builder()\n        .env(\"MOE_LOG_LEVEL\")\n        .output(\"run.log\")\n        .format(\"{t} {L} {T} \u003e {M}\\n\")\n        .rotation(10000)\n        .finish();\n    moe_logger::init(log_config);\n\n    info!(\"Di di ba ba wu~\");\n    debug!(\"Debug...\");\n    warn!(\"WARNING!\");\n    error!(\"Oops \u003e_\u003c\");\n}\n```\n\n## Features\n\n(^ω^) Here is some notice about features provided.\n\n### Output\n\nIf you specify a path to store log, Moe Logger would write formatted log to that path and unformatted log to stdout in the meanwhile.\n\n(;\u003e△\u003c) If log file exists, Moe Logger will only use stdout! So move old logs to another place before running.\n\n### Format\n\nWe are using [TinyTemplate](https://github.com/bheisler/TinyTemplate) to format content wrote to file. If you are interested in more fancy logs, you may should check its document. Moe Logger provided variables listed below:\n\n- t - [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) Date \u0026 Time\n- L - Log Level\n- T - Log Target\n- M - Log Message\n- F - File Name\n\nDefault format: `{L} {T} \u003e {M}\\n`\n\n(;\u003e△\u003c) DO NOT FORGET `\\n`\n\n### Rotation\n\nYou can specify after how many line written, Moe Logger would rename it like `output.log.x`. Default 0 for disabled.\n\n## Performance\n\n（｡・`ω´･）ノ Writing log to disk would worse the efficiency of your code. But we are always trying to optimize this problem. If you have any ideas, pull requests and issues are welcomed.\n\nThe table below shows the performance difference when you enable different features. (By running an actix-web back-end on my PC)\n\n| Feature                      | Requests per Second |\n| ---------------------------- | ------------------- |\n| No Log                       | ~16000              |\n| Only to Stdout               | ~15000              |\n| Stdout \u0026 File                | ~5600               |\n| Stdout \u0026 File(with Rotation) | ~5200               |\n\n## License\n\nMoe Logger is distributed under the terms of both Apache-2.0 and MIT license.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernelerr%2Fmoe-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkernelerr%2Fmoe-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernelerr%2Fmoe-logger/lists"}