{"id":16453266,"url":"https://github.com/trallnag/logsh","last_synced_at":"2026-03-07T07:32:45.247Z","repository":{"id":38172668,"uuid":"394442611","full_name":"trallnag/logsh","owner":"trallnag","description":"Simple POSIX-compliant logging for Shell scripts","archived":false,"fork":false,"pushed_at":"2023-05-01T10:57:37.000Z","size":633,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"trunk","last_synced_at":"2025-10-08T20:30:47.968Z","etag":null,"topics":["bash","logging","posix","shell"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trallnag.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2021-08-09T21:23:49.000Z","updated_at":"2024-10-26T07:16:36.000Z","dependencies_parsed_at":"2025-06-23T08:34:16.930Z","dependency_job_id":"658fd3e4-24ac-4a9c-b219-5a17d795ac81","html_url":"https://github.com/trallnag/logsh","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/trallnag/logsh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trallnag%2Flogsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trallnag%2Flogsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trallnag%2Flogsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trallnag%2Flogsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trallnag","download_url":"https://codeload.github.com/trallnag/logsh/tar.gz/refs/heads/trunk","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trallnag%2Flogsh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: 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":["bash","logging","posix","shell"],"created_at":"2024-10-11T10:15:04.982Z","updated_at":"2026-03-07T07:32:45.228Z","avatar_url":"https://github.com/trallnag.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![primary](https://github.com/trallnag/logsh/actions/workflows/primary.yaml/badge.svg)](https://github.com/trallnag/logsh/actions/workflows/primary.yaml)\n\n# Logsh\n\nMinimal POSIX compliant logging contained in a single Shell script made to be\nsourced in every file you want to use the library's functions.\n\n![screenshot-console-logsh](images/screenshot-console-logsh.png)\n\n## Setup\n\nDownload [`log.sh`](log.sh) to whatever location you want to use the library. So\nusually right next to the script from where `log.sh` is sourced from.\n\nAlternatively, use [`update-log.sh`](update-log.sh) to download `log.sh`. It can\nbe used to download and place `log.sh` to the directory where `update-log.sh` is\nlocated at. The script also allows downloading a specific commit reference.\n\nUsually you will end up with many `log.sh` scattered around different places.\n\n## Usage\n\nSource `log.sh` from within scripts where you want to use it with a block like\nthis:\n\n```sh\nscript_dir=$(CDPATH= cd -- \"$(dirname -- \"$0\")\" \u0026\u0026 pwd)\n\n. \"$script_dir/log.sh\"\n```\n\nNow several functions for logging will be available.\n\n- logdebug\n- loginfo\n- logsuccess\n- logwarning\n- logerror\n- logexit\n\nTo find more information about the inner workings of `log.sh` or how to\nconfigure it with environment variables, check out the script itself.\n\n## Scope\n\nIn:\n\n- Set of logging functions that are sourced from a single self-contained file.\n- POSIX-compliant and only using features that are supported by `sh`.\n- Configuration via environment variables.\n\nOut:\n\n- Being a \"real\" logging framework.\n\n## Alternative\n\nJust use this block of code:\n\n```shell\n_log() { printf '%b[%s] %s%b\\n' \"$3\" \"$2\" \"$1\" '\\033[0m' \u003e\u00262; }\nlogexit() { _log \"$1\" \"ERROR\" '\\033[31m'; exit 1; }\nlogerror() { _log \"$1\" \"ERROR\" '\\033[31m'; }\nlogwarning() { _log \"$1\" \"WARNING\" '\\033[33m'; }\nlogsuccess() { _log \"$1\" \"SUCCESS\" '\\033[32m'; }\nloginfo() { _log \"$1\" \"INFO\" '\\033[34m'; }\nlogdebug() { _log \"$1\" \"DEBUG\" '\\033[36m'; }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrallnag%2Flogsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrallnag%2Flogsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrallnag%2Flogsh/lists"}