{"id":33936716,"url":"https://github.com/dtiderko/goolog","last_synced_at":"2026-06-09T02:03:17.512Z","repository":{"id":170619824,"uuid":"646852645","full_name":"dtiderko/goolog","owner":"dtiderko","description":"This library provides the no_std-compatible goolog logger and some macros to simplify printing logs.","archived":false,"fork":false,"pushed_at":"2025-03-12T13:57:18.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-27T21:34:12.090Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dtiderko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-05-29T13:38:11.000Z","updated_at":"2026-01-03T23:47:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"3d3f9d8e-3b45-4536-9884-6be8032e8120","html_url":"https://github.com/dtiderko/goolog","commit_stats":null,"previous_names":["gooxey/goolog"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dtiderko/goolog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtiderko%2Fgoolog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtiderko%2Fgoolog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtiderko%2Fgoolog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtiderko%2Fgoolog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtiderko","download_url":"https://codeload.github.com/dtiderko/goolog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtiderko%2Fgoolog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34088014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["embedded","log","logger","macros","no-alloc","no-std","rust"],"created_at":"2025-12-12T14:31:17.683Z","updated_at":"2026-06-09T02:03:17.478Z","avatar_url":"https://github.com/dtiderko.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goolog\r\n\r\nThis library provides the no_std-compatible goolog logger and some macros to simplify printing logs.\r\n\r\n## Usage in embedded / no_std environments\r\n\r\nBecause this logger is implemented in a no_std environment, it will work with all embedded systems by default.\r\n\r\n```rust\r\n#![no_std]\r\n\r\nuse goolog::*;\r\n\r\nfn main() {\r\n    // First, we initialize the logger.\r\n    init_logger(\r\n        None,\r\n        None,\r\n        // println callback\r\n        \u0026|time_stamp, target, level, args| {\r\n            // something printing our args to the console\r\n            // example:\r\n            println!(\"[{}] {} | {:14.14} | {}\", time_stamp, target, level, args)\r\n        },\r\n    );\r\n\r\n    // Now we define a callback, which gets called whenever anyone uses the fatal! macro.\r\n    set_on_fatal(\u0026|| {\r\n        // some function to restart your embedded device\r\n    });\r\n\r\n    // Now you can start logging using either these library macros or the log crates ones.\r\n}\r\n```\r\n\r\n\r\n## Features\r\n\r\n### `std`\r\n\r\nThis feature will: \\\r\n    1. Implement the `println` callback using the standard library \\\r\n    2. Implement the on_fatal callback \\\r\n    3. Enable timestamps using [chrono](https://crates.io/crates/chrono/0.4.34)\r\n\r\n## Example\r\n\r\n\u003e All examples from here on will assume you have the `std` feature active.\r\n\r\n```rust\r\nuse goolog::*;\r\n\r\nfn main() {\r\n    // Initializing the logger\r\n    init_logger(None, None);\r\n\r\n    // See the macros module for all possible log types.\r\n    info!(\"Main\"; \"Initialized the goolog logger.\");\r\n}\r\n```\r\n\r\nThe code above will result in the following output:\r\n\r\n```bash\r\n# The timestamp (first two blocks) will only be shown when\r\n# the `std` feature is active.\r\n\r\n29.05.2023 | 14:34:33 | Main             | INFO  | Initialized the goolog logger.\r\n```\r\n\r\nBut in reality, the log message will be formatted with a color like this:\r\n\r\n```text\r\nGREY | GREY | WHITE | * | WHITE\r\n\r\n*:\r\n    DEBUG -\u003e Blue\r\n    ERROR -\u003e Red\r\n    INFO  -\u003e Green\r\n    TRACE -\u003e White\r\n    WARN  -\u003e Yellow\r\n```\r\n\r\n## Quality of life\r\n\r\nWhen printing log lines to the console using these library macros, there are two ways to specify the target:\r\n\r\n### Specification by macro\r\n\r\nThis is always possible. Even in combination with the second method described below.\r\n\r\n```rust\r\nuse goolog::*;\r\n\r\nfn main() {\r\n    init_logger(None, None);\r\n\r\n    info!(\"Main\"; \"Initialized the goolog logger.\");\r\n}\r\n```\r\n\r\n### Specification by constant\r\n\r\nFor this method, you will only need to specify the target once:\r\n\r\n```rust\r\nuse goolog::*;\r\n\r\nset_target!(\"Main\");\r\n\r\nfn main() {\r\n    init_logger(None, None);\r\n\r\n    info!(\"Initialized the goolog logger.\");\r\n\r\n    // You can still specify a different target\r\n    // just for that log line.\r\n    info!(\"Foo\"; \"Initialized the goolog logger.\");\r\n}\r\n```\r\n\r\n## Customization\r\n\r\nCurrently, there are two ways to customize your goolog logger:\r\n\r\n### Changing the logging level\r\n\r\nBy default, the logger will log at the `info` level. To change this, just provide a new log level.\r\n\r\n```rust\r\nuse goolog::*;\r\nuse goolog::log::Level;\r\n\r\nfn main() {\r\n    // Initializing the logger with the log level set to trace\r\n    init_logger(Some(Level::Trace), None);\r\n\r\n    // See the macros module for all possible log types.\r\n    // This will only be logged if the log level is set to\r\n    // trace.\r\n    trace!(\"Main\"; \"Initialized the goolog logger.\");\r\n}\r\n```\r\n\r\n### Changing the length of caller names\r\n\r\nThe default target length is 16 characters. Any given name longer than that will simply be truncated. However, there are two ways to customize this behavior:\r\n\r\n#### 1. Change the limit\r\n\r\n```rust\r\nuse goolog::*;\r\n\r\nfn main() {\r\n    // Initialize the logger with a new target length of 32\r\n    // characters.\r\n    init_logger(None, Some(32));\r\n\r\n    // ...\r\n\r\n    // You can also change the target length at runtime.\r\n    set_target_length(8)\r\n}\r\n```\r\n\r\n#### 2. Remove the limit\r\n\r\nTo do this set the `target_length` to `0` using either of the two ways shown above.\r\n\r\nBut before you do this, you might consider the drawbacks:\r\nIf no limit is given, the logger has no way of knowing how much space to leave for the name. Therefore, each log line will 'bend' around the name, which will look something like this:\r\n\r\n```text\r\n29.05.2023 | 14:34:33 | Main | INFO  | Starting some very important things...\r\n29.05.2023 | 14:34:33 | MySuperAwesomeClient | INFO  | Starting...\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtiderko%2Fgoolog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtiderko%2Fgoolog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtiderko%2Fgoolog/lists"}