Skip to content
/ glog Public

A Gleam implementation of Erlang logger inspired from Logrus

License

Notifications You must be signed in to change notification settings

defgenx/glog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glog

Package Version Hex Docs

A Gleam implementation of Erlang logger inspired from Logrus API.

Task List

  • Write documentation
  • Add unit tests
  • 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

import glog
import glog/field
import glog/arg
import glog/level


pub 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 <config_file>' gleam run

Quick start

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:

gleam add glog

and its documentation can be found at https://hexdocs.pm/glog.

About

A Gleam implementation of Erlang logger inspired from Logrus

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages