https://github.com/renderedtext/log-tee
tee-ing data to logger
https://github.com/renderedtext/log-tee
Last synced: 4 months ago
JSON representation
tee-ing data to logger
- Host: GitHub
- URL: https://github.com/renderedtext/log-tee
- Owner: renderedtext
- License: apache-2.0
- Created: 2017-01-10T21:20:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-02-20T15:24:36.000Z (over 1 year ago)
- Last Synced: 2025-04-14T11:42:33.379Z (about 1 year ago)
- Language: Elixir
- Size: 12.7 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LogTee
Library repository.
Provides logging functions suitable for pipelining:
## Installation
Add log_tee to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:log_tee, github: "renderedtext/log-tee"}
]
end
```
## Usage
You can use the `LogTee` module to log messages at different severity levels while processing data in a pipeline.
### Example
```
[1, 2, 3]
|> LogTee.debug("list content")
|> Enum.sum
|> LogTee.debug("sum")
```
This will log the content of the list and the sum of the list elements.
### Available Functions
- `LogTee.debug(item, tag)`
- `LogTee.info(item, tag)`
- `LogTee.warn(item, tag)`
- `LogTee.error(item, tag)`
Each function logs the `item` with the specified `tag` at the corresponding severity level and returns the `item`.
## License
This software is licensed under [the Apache 2.0 license](LICENSE).