{"id":19493343,"url":"https://github.com/negrel/log4bash","last_synced_at":"2025-06-12T12:34:16.770Z","repository":{"id":109374172,"uuid":"529359043","full_name":"negrel/log4bash","owner":"negrel","description":"Minimal bash logging library","archived":false,"fork":false,"pushed_at":"2024-01-07T18:29:21.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-08T09:13:59.142Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/negrel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-08-26T18:03:30.000Z","updated_at":"2022-08-26T20:04:11.000Z","dependencies_parsed_at":"2024-11-10T21:26:56.807Z","dependency_job_id":"008825da-15fd-4466-aa9b-023447e225ff","html_url":"https://github.com/negrel/log4bash","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/negrel%2Flog4bash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/negrel%2Flog4bash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/negrel%2Flog4bash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/negrel%2Flog4bash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/negrel","download_url":"https://codeload.github.com/negrel/log4bash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240738778,"owners_count":19849653,"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":[],"created_at":"2024-11-10T21:25:26.160Z","updated_at":"2025-02-25T20:20:00.800Z","avatar_url":"https://github.com/negrel.png","language":"Shell","funding_links":["https://www.buymeacoffee.com/negrel"],"categories":[],"sub_categories":[],"readme":"# `log4bash` - Minimal log library for bash.\n\n## :question: Why ?\n\nI was tired of writing the same log functions for my bash scripts.\n\n## Getting started\n\n`log4bash` is a one file library, you can just source and start using it as follow:\n\n```shell\nset -euo pipefail\n\nsource log4bash/lib.sh\n\n# Set log level (one of \"trace\" \"debug\" \"info\" \"warn\" \"error\" \"fatal\" \"panic\" \"disabled\")\nLOG_LEVEL=\"trace\"\n\n# Default to stderr\nLOG_OUTPUT=/dev/stdout\n\n# There is one function per log level\nlog_trace \"trace log\"\nlog_debug \"debug level\"\nlog_info \"info level\"\nlog_warn \"warn level\"\nlog_error \"error level\"\n# The following log functions runs in a subshell\n# as they return a non zero exit code\n(log_fatal \"fatal level\")\n# At panic level a stacktrace is print\n(log_panic \"panic level\")\n\n# Dynamic level\nlog \"warn\" \"log at warn level\"\n\n# All of the above function works also through a pipe\necho -e \"a piped msg\\nand a second one\" | log_info\n\n# You can customize colors as follow.\n# Change the color for the trace level\n_log_level_color[\"trace\"]=\"red\"\n# Or change the red color\n_log_color[\"red\"]=\"31\"\n\nlog_trace \"a red trace log\"\n\n# If you don't want colors, you can remove them as follow\nunset _log_level_color\n\n# And more...\n# log4bash code is self documented, don't hesitate to read it !\n```\n\n![output example](./.github/example_screenshot.png)\n\n## Contributing\n\nIf you want to contribute to `log4bash` to add a feature or improve the code contact\nme at [negrel.dev@protonmail.com](mailto:negrel.dev@protonmail.com), open an\n[issue](https://github.com/negrel/log4bash/issues) or make a\n[pull request](https://github.com/negrel/log4bash/pulls).\n\n## :stars: Show your support\n\nPlease give a :star: if this project helped you!\n\n[![buy me a coffee](.github/bmc-button.png)](https://www.buymeacoffee.com/negrel)\n\n## :scroll: License\n\nMIT © [Alexandre Negrel](https://www.negrel.dev/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnegrel%2Flog4bash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnegrel%2Flog4bash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnegrel%2Flog4bash/lists"}