{"id":23341827,"url":"https://github.com/geokureli/logger","last_synced_at":"2026-02-11T20:02:46.964Z","repository":{"id":268472677,"uuid":"904453224","full_name":"Geokureli/Logger","owner":"Geokureli","description":"Simplify the categorization and prioritization of logs, errors and assertions.","archived":false,"fork":false,"pushed_at":"2025-08-26T14:47:53.000Z","size":44,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-31T13:39:02.186Z","etag":null,"topics":["haxe","log","logging","trace"],"latest_commit_sha":null,"homepage":"","language":"Haxe","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/Geokureli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-12-16T23:19:49.000Z","updated_at":"2025-02-13T18:57:55.000Z","dependencies_parsed_at":"2024-12-17T01:40:00.047Z","dependency_job_id":"d5ac2372-a501-4bdb-8a49-bbd815050159","html_url":"https://github.com/Geokureli/Logger","commit_stats":null,"previous_names":["geokureli/logger"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Geokureli/Logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geokureli%2FLogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geokureli%2FLogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geokureli%2FLogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geokureli%2FLogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Geokureli","download_url":"https://codeload.github.com/Geokureli/Logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geokureli%2FLogger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29343683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T18:58:20.535Z","status":"ssl_error","status_checked_at":"2026-02-11T18:56:44.814Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["haxe","log","logging","trace"],"created_at":"2024-12-21T05:12:07.005Z","updated_at":"2026-02-11T20:02:46.947Z","avatar_url":"https://github.com/Geokureli.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logger\n\nTool used to simplify the categorization of logs, and easily customize which type of logs are displayed, and which throw exceptions.\n\n## Setup\n\n  1. Install Logger (coming soon to haxelib, just github for now).\n     \n     Command Line:\n     ```haxelib git logger http://github.com/Geokureli/Logger```\n  2. Include Logger in your project.xml:  \n     \n     ```xml\n     \u003chaxelib name=\"logger\"/\u003e\n     ```\n\n## Creating categories\nTo create categories, simple instantiate multiple `Logger` instances, like so:\n\n```haxe\nstatic public var combatLog = new Logger(\"Combat\", WARN);\nstatic public var resourceLog = new Logger(\"Res\", INFO);\n```\n\nTypically, though, you would give each static class, tool or important object it's own logger, such as `CombatUtil.log` or `myHero.log`. For uncategorized logs, simply use `Logger.log`\n\n## Logging\n\nTo log, you can call Logger instances as if they were functions, for example: `Logger.log(imporantInfo);` or `CombatUtil.log(\"battle started\")`, but each logger also has various priorities that are conditionally logged, like `Logger.log.error(\"Missing asset\")` or `CombatUtil.log.verbose(\"attacked for 5 damage\");`. While these log priorities can be called, they too, also have fields. You can disable a certain priority like so: `log.verbose.enabled = false;` or you can make a certain priority throw exceptions instead of logging via: `log.warn.throws = true;`\n\nExample:\n```hx\nclass Main\n{\n    static public var log = new Logger(\"Special\", WARN, ERROR); // logs warnings, throws exceptions on errors\n    static public function main():Void\n    {\n        log(\"test log\"); // Output: Special - test log\n        log.warn(\"test log\"); // Output: Special - WARN:test log\n        log.info(\"test log\"); // ignored\n        log.setPriority(INFO);\n        log.info(\"test log\"); // Special - INFO:test log\n        log.verbose(\"test log\"); // ignored\n        log.verbose.enabled = true;\n        log.verbose(\"test log\"); // Output: Special - VERBOSE:test log\n        try\n        {\n            log.error(\"test log\"); // throws exception\n        }\n        catch(e)\n        {\n            log('exception thrown: ${e.message}'); // Output: Special - exception thrown: Special - ERROR:test log\n        }\n        // set custom logger\n        log.log = (msg, ?pos) -\u003e haxe.Log.trace('SPECIAL_$msg', pos);\n        log.error.throws = false;\n        log.error(\"test log\"); // Output: SPECIAL_ERROR:test log\n    }\n}\n```\n\n## Assertions\nEach log priority has an `assert`, which has a variety of standard assertion methods like `isTrue(someBool)` or `equals(someInt, 5)` which will log if untrue. You can also call `assert` directly with a condition and it will output the condition's expression in the logged message. For example:\n```hx\nfinal log = Logger.log;\nlog.error.throws = false;\n\n// Check bool\nfinal condition = false;\nlog.error.assert.isTrue(condition); // Error: Expected true, found false\n\nfinal a = 5;\n\n// check equality\nlog.error.assert.equals(a, 10); // Error: Expected 10, found 5\n\n// check expression\nlog.error.assert(a == 10); // Error: Assertion failed: a == 10\n\n// shorter equivalent\nlog.assert(a == 10); // Error: Assertion failed: a == 10\n```\n\n## Enabling logs via compile flags\nWhile the `Logger` constructor has `priority` and `throwPriority` args, these can be overriden from compiler flags, by adding the flag `-D log=WARN` all log priorities less than `WARN` (i.e.: `INFO` and `VERBOSE`) are disabled. You can also specify exactly which priorities are enabled, for example, `-D log=[info,error]` will disable all priorities other than `INFO` and `ERROR`. The `log` flag will also effect all categories, unless the category has it's own log priorities set in compiler flags. For example, a logger with the id \"Combat\" can have its log priorities set via `-D combat.log=error`. There is a similar `throw` flag to specify which logs throw an exception\n\n### Quick overview\n - `-D log=WARN`: Set global log-priority to warnings and errors\n - `-D throw=ERROR`: Set global throw-priority to errors\n - `-D log=[info,error]`: Only log info and errors, not warnings and verbose\n - `-D combat.log=verbose`: Enable ALL logs with the id \"Combat\" (not case sensitive), overrides global log-priority\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeokureli%2Flogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeokureli%2Flogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeokureli%2Flogger/lists"}