Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/defgenx/glog
A Gleam implementation of Erlang logger inspired from Logrus
https://github.com/defgenx/glog
erlang-logger gleam gleam-lang gleam-language log logger logging
Last synced: 27 days ago
JSON representation
A Gleam implementation of Erlang logger inspired from Logrus
- Host: GitHub
- URL: https://github.com/defgenx/glog
- Owner: defgenx
- License: apache-2.0
- Created: 2022-11-24T11:40:44.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T15:03:44.000Z (8 months ago)
- Last Synced: 2024-09-17T03:30:03.505Z (3 months ago)
- Topics: erlang-logger, gleam, gleam-lang, gleam-language, log, logger, logging
- Language: Gleam
- Homepage:
- Size: 79.1 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gleam - glog - [📚](https://hexdocs.pm/glog/) - A Gleam implementation of Erlang logger (Packages / Logging and Monitoring)
README
# glog
[![Package Version](https://img.shields.io/hexpm/v/glog)](https://hex.pm/packages/glog)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/glog/)A Gleam implementation of Erlang logger inspired from [Logrus](https://github.com/sirupsen/logrus) API.
![](assets/small_glog_logo.png)
## Task List
- [x] Write documentation
- [x] Add unit tests
- [x] Improve API with `add_error`, `add_result` `add_option`...
- [ ] Add an API to configure the logger (custom configuration file)## Usage
The Erlang logger is asynchronous by default, please read the [logger chapter](https://www.erlang.org/doc/apps/kernel/logger_chapter.html#message-queue-length)
```gleam
import glog
import glog/field
import glog/arg
import glog/levelpub fn main() {
let logger = glog.new()
glog.set_primary_log_level(level.All)
glog.set_default_config()logger
|> glog.add("foo", "bar")
|> glog.add_field(field.new("woo", "zoo"))
|> glog.infof("I'll be ~p", [arg.new("back")])
}
```## Things to know
* Gleam do not support configuration files at the moment. To load a custom Erlang config file use the following
command: `ERL_FLAGS='-config ' gleam run`
* Please read the [logger documentation](https://www.erlang.org/doc/man/logger.html) to know more about
configuration files## Quick start
```sh
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell
```## Installation
This package can be added to your Gleam project:
```sh
gleam add glog
```and its documentation can be found at .