{"id":31901049,"url":"https://github.com/berrysoft/winlog","last_synced_at":"2025-10-13T12:52:13.726Z","repository":{"id":161078676,"uuid":"635810872","full_name":"Berrysoft/winlog","owner":"Berrysoft","description":"Fork of https://gitlab.com/arbitrix/winlog","archived":false,"fork":false,"pushed_at":"2025-01-22T14:42:07.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T15:34:07.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Berrysoft.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":"2023-05-03T13:58:06.000Z","updated_at":"2025-01-22T14:42:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"4bad2b77-ad84-4687-882b-3207dfa7e648","html_url":"https://github.com/Berrysoft/winlog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Berrysoft/winlog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fwinlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fwinlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fwinlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fwinlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Berrysoft","download_url":"https://codeload.github.com/Berrysoft/winlog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fwinlog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015087,"owners_count":26085644,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"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":[],"created_at":"2025-10-13T12:52:09.343Z","updated_at":"2025-10-13T12:52:13.717Z","avatar_url":"https://github.com/Berrysoft.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# winlog2\n\nThis is a fork of `winlog`.\n\nA simple [Rust log](https://docs.rs/log/latest/log/) backend to send messages to the [Windows event log](https://docs.microsoft.com/en-us/windows/desktop/eventlog/event-logging).\n\n## Features\n\n* Writes Rust log messages to the Windows event log using the\n  [RegisterEventSourceW](https://docs.microsoft.com/en-us/windows/desktop/api/Winbase/nf-winbase-registereventsourcew)\n  and [ReportEventW](https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-reporteventw) APIs.\n* Supports `env_logger` filtering, initialized from RUST_LOG environment variable. (optional)\n* Provides utility functions to register/unregister your\n  [event source](https://docs.microsoft.com/en-us/windows/desktop/eventlog/event-sources) in the Windows registry.\n* Embeds a small (120-byte) message resource library containing the\n  necessary log message templates in your executable.\n\nThe five Rust log levels are mapped to Windows [event types](https://docs.microsoft.com/en-us/windows/desktop/eventlog/event-types) as follows:\n\n| Rust Log Level | Windows Event Type | Windows Event Id |\n| -------------- | ------------------ | ---------------- |\n| Error          | Error              | 1                |\n| Warn           | Warning            | 2                |\n| Info           | Informational      | 3                |\n| Debug          | Informational      | 4                |\n| Trace          | Informational      | 5                |\n\n\n## Requirements\n\n* Windows or MinGW\n* [Windows, optional] PowerShell (used for the end-to-end test)\n\n## Usage\n\n### Cargo.toml\n\nPlain winlog:\n```\n[dependencies]\nlog = \"*\"\nwinlog = \"*\"\n```\nOr to enable env_logger filtering support:\n```\n[dependencies]\nlog = \"*\"\nwinlog = { version = \"0.2.5\", features = [\"env_logger\"] }\n```\n\n### Register log source with Windows\n\nRegister the log source in the Windows registry:\n```\nwinlog::register(\"Example Log\").unwrap();\n```\nThis usually requires `Administrator` permission so this is usually done during\ninstallation time.\n\nIf your MSI installer (or similar) registers your event sources you should not call this.\n\n\n### Log events\n\nWithout env_logger filtering:\n```\nuse log::{info, trace};\n\nwinlog::init(\"Example Log\").unwrap();\n\ninfo!(\"Hello, Event Log\");\ntrace!(\"This will be logged too\");\n```\n\nUse the winlog backend with env_logger filter enabled:\n```\nuse log::{info, trace};\n\n// # export RUST_LOG=\"info\"\nwinlog::init(\"Example Log\").unwrap();\ninfo!(\"Hello, Event Log\");\ntrace!(\"This will be filtered out\");\n```\n\n### Deregister log source\n\nDeregister the log source: \n```\nwinlog::deregister(\"Example Log\").unwrap();\n```\nThis is usually done during program uninstall. If your MSI \ninstaller (or similar) deregisters your event sources you should not call this.\n\n## What's New\n\n### 0.3.0\n* Fork from original repo.\n* Use `windows-sys` instead of `winapi`.\n* Update other dependencies.\n* Generate `eventmsgs.rc` and compile it with `winres`.\n* Fix `end-to-end` test to deregister correctly even if it fails.\n* Remove APIs that silently fails.\n\n### 0.2.6\n\n* Disable unneeded regex features to speed up the build.\n* Improve error reporting/handling in `build.rs`.\n\n### 0.2.5\n\n* Gitlab CI builds on Windows 10 and Debian/MinGW.\n* Optional support for env_logger event (enable feature `env_logger`).\n* Always run `windrc/windrc` on MinGW.\n* Include linker configuration in `.cargo/config`. \n\n## Building\n\n### Windows\n\n```sh\ncargo build --release\n```\n\n### MinGW\n\nInstall MinGW (Ubuntu):\n\n```sh\nsudo apt install mingw-w64\n```\n\nInstall Rust:\n\n```sh\nrustup target install x86_64-pc-windows-gnu\n```\n\nCurrently the install from rustup doesn't use the correct linker so you have to add the following to `.cargo/config`:\n\n    [target.x86_64-pc-windows-gnu]\n    linker = \"/usr/bin/x86_64-w64-mingw32-gcc\"\n\nBuild:\n```sh\ncargo build --release\n```\n\n### Internals\n\nArtifacts `eventmsgs.rc` and `MSG00409.bin` are under source control so users \ndon't need to have `mc.exe` installed for a standard build.\n\n## Testing\n\nThe end-to-end test requires 'Full Control' permissions on the \n`HKLM\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application`\nregistry key.\n\n```cargo test```\n\nProcess:\n1. Create a unique temporary event source name (`winlog-test-###########`).\n2. Register our compiled test executable as ```EventMessageFile``` for \n   the event source in the Windows registry. You can see a new key at \n   `HKLM\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\winlog-test-###########`.\n2. Write some log messages to the event source.\n3. Use PowerShell to retrieve the logged messages.\n4. Assert that the retrieved log messages are correct. \n5. Deregister our event source. This removes the `winlog-test-###########` \n   registry key.\n\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)\n\nat your option.\n\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted \nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall \nbe dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberrysoft%2Fwinlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberrysoft%2Fwinlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberrysoft%2Fwinlog/lists"}