Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elbow-jason/slogger
Simple Module-Level Logging in Elixir
https://github.com/elbow-jason/slogger
elixir flexible logging slogger
Last synced: 3 months ago
JSON representation
Simple Module-Level Logging in Elixir
- Host: GitHub
- URL: https://github.com/elbow-jason/slogger
- Owner: elbow-jason
- License: mit
- Created: 2017-01-08T01:22:29.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-09T08:16:18.000Z (over 6 years ago)
- Last Synced: 2024-09-29T00:48:30.805Z (5 months ago)
- Topics: elixir, flexible, logging, slogger
- Language: Elixir
- Homepage:
- Size: 28.3 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
![]()
Simple Module-Level Logging# Slogger
[![Build Status](https://travis-ci.org/elbow-jason/slogger.svg?branch=master)](https://travis-ci.org/elbow-jason/slogger)
Slogger is a simple logger that allows flexible, and easily customizable, module-level control of logging.
## Usage
Simple:
```elixir
defmodule SimpleSlogger do
use Slogger
# this module's Slogger is set to the default :info
end
```With a logging level:
```elixir
defmodule LeveledSlogger do
use Slogger, level: :debug
# you can configure slogger log level directly in the module.
enddefmodule MyModule do
def is_one?(1) do
# you will not see this debug log entry
LeveledSlogger.debug("it was one")
true
end
def is_one?(_) do
# you will see this error log entry
LeveledSlogger.error("WOOP WOOP WOOP ALARM. NOT ONE.")
false
end
end
```## Installation
[Slogger](https://hex.pm/packages/slogger) is available on hex.pm. To use Slogger, add `slogger` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:slogger, "~> 0.2.0"}]
end```