https://github.com/filmil/fshlib
My shell library: sundry bash utilities
https://github.com/filmil/fshlib
bash bazel library
Last synced: 5 months ago
JSON representation
My shell library: sundry bash utilities
- Host: GitHub
- URL: https://github.com/filmil/fshlib
- Owner: filmil
- License: apache-2.0
- Created: 2025-11-28T02:09:15.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2026-01-18T00:22:25.000Z (6 months ago)
- Last Synced: 2026-01-18T17:40:37.029Z (6 months ago)
- Topics: bash, bazel, library
- Language: Shell
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fshlib
[](https://github.com/filmil/fshlib/actions/workflows/test.yml)
[](https://github.com/filmil/fshlib/actions/workflows/publish-bcr.yml)
[](https://github.com/filmil/fshlib/actions/workflows/publish.yml)
[](https://github.com/filmil/fshlib/actions/workflows/tag-and-release.yml)
`fshlib` is a simple shell library for logging. It provides a set of functions to log messages with different severity levels.
## Usage
To use the library, source the `log.bash` file in your script:
```bash
source "path/to/log.bash"
```
Then you can use the logging functions:
```bash
log::info "This is an info message"
log::warn "This is a warning message"
log::error "This is an error message"
```
## Functions
- `log::info`: Logs an informational message.
- `log::warn`: Logs a warning message.
- `log::error`: Logs an error message.
- `log::debug`: Logs a debug message. This message is only shown if the `DEBUG` environment variable is set to `true` or `log`.
- `log::prefix`: Prefixes each line of the input with a given string.
## Example
```bash
#!/usr/bin/env bash
source "path/to/log.bash"
log::info "Starting the script"
log::warn "Something might be wrong"
log::error "Something went wrong"
echo "some output" | log::prefix "[my-prefix] "
```