{"id":24515461,"url":"https://github.com/mbekkomo/log.sh","last_synced_at":"2025-03-15T10:29:17.109Z","repository":{"id":167202283,"uuid":"642322676","full_name":"mbekkomo/log.sh","owner":"mbekkomo","description":"A logging library for POSIX sh and other shells (Bash, Zsh, Dash).","archived":false,"fork":false,"pushed_at":"2023-05-19T10:36:09.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T01:17:44.787Z","etag":null,"topics":["bash","dash","logger","posix-sh","zsh"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/mbekkomo.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}},"created_at":"2023-05-18T10:05:34.000Z","updated_at":"2023-05-19T12:43:24.000Z","dependencies_parsed_at":"2023-12-06T11:14:37.461Z","dependency_job_id":"3d7ea2a5-0dce-4887-8405-4a4decc0175f","html_url":"https://github.com/mbekkomo/log.sh","commit_stats":null,"previous_names":["urnightmaree/log.sh","komodcat/log.sh","komothecat/log.sh","cattokomo/log.sh","mbekkomo/log.sh"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbekkomo%2Flog.sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbekkomo%2Flog.sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbekkomo%2Flog.sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbekkomo%2Flog.sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbekkomo","download_url":"https://codeload.github.com/mbekkomo/log.sh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243717940,"owners_count":20336456,"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":["bash","dash","logger","posix-sh","zsh"],"created_at":"2025-01-22T01:17:53.943Z","updated_at":"2025-03-15T10:29:17.082Z","avatar_url":"https://github.com/mbekkomo.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# log.sh\nA logging library for POSIX sh and other shells (Bash, Zsh, Dash).\n\n![Preview](/assets/preview.png)\u003cbr  /\u003e\n\u003csub\u003eTaken inside [Termux](https://termux.dev) app with font JetBrains Mono and [Catppuccin](https://github.com/Catppuccin) Mocha theme and background.\u003c/sub\u003e\n\n## Installation\nDrop [log.sh](/log.sh) into the same directory as your script and source it.\n```sh\nsource ./log.sh # can be /path/to/log.sh if you place it somewhere\n```\n\n## Usage\nAfter sourcing, a `log` function is available in your script. `log` function takes first argument as log mode and the rest of the arguments are the messages, if first argument are not an uppercase mode name or not a mode, the log mode will be set to `TRACE` and make the first argument of the function as one of the messages.\n\n  - Available log modes:\n    - `TRACE`\n    - `DEBUG`\n    - `INFO`\n    - `WARN`\n    - `ERROR`\n    - `FATAL`\n\n## Additional options\nlog.sh provide way to set additional options, by setting variable to a certain value.\n\n### `LOG_NOCOLOR`\nDefault: `\"\"`\n\nWhether colors are disabled or not. If set to anything besides null string or empty string, disable ansi-coloring when printed to stdout. This is useful if your terminal doesn't support ansi-coloring.\n\n### `LOG_FILE`\nDefault: `\"\"`\n\nThe path of the file where the log should be stored. By default, it is set to null string (no file are written), but if set, log.sh will write logs into the file.\n\n### `LOG_LEVEL`\nDefault: `\"TRACE\"`\n\nThe minimum level to log. Any log level that is lower than `LOG_LEVEL` is ignored and no text is printed or written. By default the value is set to `\"TRACE\"`, the lowest log level, as no log messages are ignored.\n\nThe level of each log modes, starting from the lowest: `\"TRACE\"` `\"DEBUG\"` `\"INFO\"` `\"WARN\"` `\"ERROR\"` `\"FATAL\"`\n\n## License\n\nlog.sh are licensed under MIT license, see [LICENSE](/license) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbekkomo%2Flog.sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbekkomo%2Flog.sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbekkomo%2Flog.sh/lists"}