{"id":17946570,"url":"https://github.com/tomosfps/colourful-logger","last_synced_at":"2025-03-24T20:32:46.583Z","repository":{"id":256825506,"uuid":"856545083","full_name":"tomosfps/colourful-logger","owner":"tomosfps","description":"A minimal colourful logger for Rust","archived":false,"fork":false,"pushed_at":"2025-02-01T06:05:51.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T04:14:24.458Z","etag":null,"topics":["easy-to-use","lightweight","logging","rust-lang"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/colourful-logger","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/tomosfps.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}},"created_at":"2024-09-12T18:57:17.000Z","updated_at":"2025-02-01T06:05:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"36cef0d2-5a08-47e1-aeae-9e30d0e3d71f","html_url":"https://github.com/tomosfps/colourful-logger","commit_stats":null,"previous_names":["devtomos/logger","eeius/colourful-logger","devtomos/colourful-logger","ehiraa/colourful-logger","tomosfps/colourful-logger"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomosfps%2Fcolourful-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomosfps%2Fcolourful-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomosfps%2Fcolourful-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomosfps%2Fcolourful-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomosfps","download_url":"https://codeload.github.com/tomosfps/colourful-logger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245348304,"owners_count":20600623,"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":["easy-to-use","lightweight","logging","rust-lang"],"created_at":"2024-10-29T07:06:24.287Z","updated_at":"2025-03-24T20:32:46.574Z","avatar_url":"https://github.com/tomosfps.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Colourful-Logger 2.0\n\nThe Colourful-Logger is a simple yet effective logging utility designed to enhance the readability of log messages by incorporating vibrant colors.\nAllowing you to also print structs, strings and other important types, either to the terminal or to a file.\n\n## Features\n- [x] Easy to use\n- [x] Colour coded log levels\n- [x] Quick identification of log types\n- [x] Enhanced readability\n- [x] Simple integration into projects\n- [x] Immediate visual improvement\n- [x] Terminal or File Logging\n- [x] Log any seralised data structures\n- [x] Log filtering\n\n## How to use\nYou can use either lazy_static! to use the logger as a global variable\nColourful logger also has a built in default(), if you want a preset Logging.\n\n\u003e [!IMPORTANT]\n\u003e If you want to log structs, which are typically not supported automatically\n\u003e Add `serde = { version = \"1.0.213\", features = [\"derive\"] }` to your `Cargo.toml`\n\u003e And then append `#[derive(Serialize)]` above your struct to seralise it. \u003cbr/\u003e\n\u003e It is then accessible to the logger as an object.\n\nYou may change the log file, remove the log file or even change the LogLevel at any time.\n\n### Change File and LogLevel\n```rust\nuse colourful_logger::{Logger, LogLevel};\n\nfn main() {\n    let mut logger = Logger::default();\n\n    logger.set_file(\"file_name.log\");\n    logger.remove_file();\n    logger.set_log_level(LogLevel::Warn);\n}\n```\n\n### Without Default, but Lazy Static!\n\n```rust\nuse colourful_logger::{Logger, LogLevel};\nuse lazy_static::lazy_static;\nuse serde::Serialize;\n\nlazy_static! {\n    // Keep log_file as \"\" so that it doesn't log to the file.\n    // If you want it to then be sure to type in the file name and extension.\n    static ref LOGGER: Logger = Logger::new(LogLevel::Info, Some(\"\"));\n}\n\n#[derive(Serialize)]\nstruct RandomStruct {\n    field1: String,\n    field2: i32,\n}\n\nfn main(): {\n    let random_struct = RandomStruct{ field1: \"some random value 1\".to_string(), field2: 540 };\n    LOGGER.info(\"This is a message!\", \"Tag\", false, random_struct);\n    LOGGER.info(\"Another message!\", \"Main\", true, \"Joe\".to_string());\n    LOGGER.info_single(\"This is a single message!\", \"Hello\");\n\n    // Output\n    // [2024-10-25 07:08:11] info: ┏ [Tag] This is a message!\n    //                             ┗ [1] {\"field1\":\"some random value 2\",\"field2\":69}\n    //\n    // [2024-10-25 07:08:11] info:  ┏ [Main] Another message!\n    //                              ┃ at main.rs:42:5 [colourful_logger::main::h64e1f92e8d679d92]\n    //                              ┗ [1] \"Joe\"\n    //\n    // [2024-10-25 07:08:11] info:  ▪ [Hello] This is a single message!\n}\n```\n\n### With Default, without Lazy Static!\n\n```rust\nuse colourful_logger::Logger as Logger;\n\n#[derive(Serialize)]\nstruct RandomStruct {\n    field1: String,\n    field2: i32,\n}\n\nfn main(): {\n    let logger = Logger::default();\n\n    logger.info(\"This is a message!\", \"Tag\", false, random_struct);\n    logger.info(\"Another message!\", \"Main\", true, \"Joe\".to_string());\n    logger.info_single(\"This is a single message!\", \"Hello\");\n\n    // Output\n    // [2024-10-25 07:08:11] info: ┏ [Tag] This is a message!\n    //                              ┗ [1] {\"field1\":\"some random value 2\",\"field2\":69}\n    //\n    // [2024-10-25 07:08:11] info:  ┏ [Main] Another message!\n    //                              ┃ at main.rs:42:5 [colourful_logger::main::h64e1f92e8d679d92]\n    //                              ┗ [1] \"Joe\"\n    //\n    // [2024-10-25 07:08:11] info:  ▪ [Hello] This is a single message!\n}\n```\n\n## Bug Reports | Features\nIf there are any bugs, or features you'd like to implement into the logger, feel free to create a pr request and it'll be looked into.\n\n## License\nThis project uses the following license: [MIT LICENSE](https://github.com/devtomos/colourful-logger/blob/main/README.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomosfps%2Fcolourful-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomosfps%2Fcolourful-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomosfps%2Fcolourful-logger/lists"}