{"id":22299398,"url":"https://github.com/bboozzoo/glib_logger","last_synced_at":"2025-10-08T12:37:21.016Z","repository":{"id":62439576,"uuid":"239588527","full_name":"bboozzoo/glib_logger","owner":"bboozzoo","description":"Rust logger integration with Glib message logging facilities","archived":false,"fork":false,"pushed_at":"2020-07-02T10:31:14.000Z","size":7,"stargazers_count":0,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-31T11:56:40.755Z","etag":null,"topics":["glib2","log","logger","logging"],"latest_commit_sha":null,"homepage":null,"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/bboozzoo.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}},"created_at":"2020-02-10T18:56:45.000Z","updated_at":"2020-02-10T19:45:29.000Z","dependencies_parsed_at":"2022-11-01T22:01:41.175Z","dependency_job_id":null,"html_url":"https://github.com/bboozzoo/glib_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/bboozzoo%2Fglib_logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bboozzoo%2Fglib_logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bboozzoo%2Fglib_logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bboozzoo%2Fglib_logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bboozzoo","download_url":"https://codeload.github.com/bboozzoo/glib_logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227600302,"owners_count":17791938,"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":["glib2","log","logger","logging"],"created_at":"2024-12-03T18:06:02.616Z","updated_at":"2025-10-08T12:37:15.984Z","avatar_url":"https://github.com/bboozzoo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"A simple logger that integrates with [glib message\nlogging](https://developer.gnome.org/glib/unstable/glib-Message-Logging.html)\nmechanism. The logger is useful when one wants to integrate a piece of Rust\ncode into a larger application which is already using glib/gio stack.\n\n### Example\n\n```rust\nuse std::env;\n\nuse log;\n\nfn main() {\n    env::set_var(\"G_MESSAGES_DEBUG\", \"all\");\n\n    glib_logger::init(\u0026glib_logger::SIMPLE);\n    log::set_max_level(log::LevelFilter::Debug);\n\n    log::info!(\"info message: {}\", 2);\n    log::warn!(\"warning message: {}\", \"foobar\");\n    log::debug!(\"Hello, world!\");\n}\n```\n\nEquivalent Vala code:\n\n```vala\npublic void main() {\n    Environment.set_variable (\"G_MESSAGES_DEBUG\", \"all\", false);\n\n    info(\"info message: %d\", 2);\n    warning(\"warning message: %s\", \"foobar\");\n    debug(\"Hello, world!\");\n}\n```\n\nRunning:\n\n```bash\n$ ./glib_logger_test\n** INFO: 20:18:34.074: src/main.rs:12: info message: 2\n\n** (process:39403): WARNING **: 20:18:34.076: src/main.rs:13: warning message: foobar\n** (process:39403): DEBUG: 20:18:34.076: src/main.rs:15: Hello, world!\n```\n\n### Details\n\nDue to slight differences between the meaning of respective log levels, the\ncrate takes certain liberties. Specifically the log level mappings are:\n\n- `Level::Trace`, `Level::Debug` =\u003e G_LOG_LEVEL_DEBUG\n- `Level::Error` =\u003e G_LOG_LEVEL_CRITICAL\n- `Level::Info` =\u003e G_LOG_LEVEL_INFO\n- `Level::Warn` =\u003e G_LOG_LEVEL_WARNING\n\nThe G_LOG_LEVEL_ERROR (as produced via `g_error()` macro in C) is not mapped to\nany of `log::Level` enum values. The reason is that `g_error()` is fatal, while\n`log::error!()` is not.\n\nThe formatting is done fully in Rust. However, log filtering based on level is\ndone in Glib. It is advisable to set `G_MESSAGES_DEBUG=all` environment variable.\n\nUsing Glib a domain can be set per file by using `#define G_LOG_DOMAIN\n\"my-domain\"` directly in C code. This functionality is not avaialble when using\n`glib_logger`, all logs are emitted with a NULL domain.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbboozzoo%2Fglib_logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbboozzoo%2Fglib_logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbboozzoo%2Fglib_logger/lists"}