Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ erl_crash.dump
# Ignore package tarball (built via "mix hex.build").
pretty_log-*.tar

# Temporary files, for example, from tests.
/tmp/
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# PrettyLog

PrettyLog is an Elixir library which provides some ready-to-use log formatters, including a Logfmt formatter.
[![CI](https://github.com/ispirata/pretty_log/actions/workflows/ci.yml/badge.svg)](https://github.com/ispirata/pretty_log/actions/workflows/ci.yml)
[![Module Version](https://img.shields.io/hexpm/v/pretty_log.svg)](https://hex.pm/packages/pretty_log)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/pretty_log/)
[![Total Download](https://img.shields.io/hexpm/dt/pretty_log.svg)](https://hex.pm/packages/pretty_log)
[![License](https://img.shields.io/hexpm/l/pretty_log.svg)](https://github.com/ispirata/pretty_log/blob/master/LICENSE)
[![Last Updated](https://img.shields.io/github/last-commit/ispirata/pretty_log.svg)](https://github.com/ispirata/pretty_log/commits/master)

PrettyLog is an Elixir library which provides some ready-to-use log formatters, including a `Logfmt` formatter.

## Installation
- Add `:pretty_log` dependency to your project's `mix.exs`:

Add `:pretty_log` dependency to your project's `mix.exs`:

```elixir
def deps do
Expand All @@ -12,7 +20,11 @@ def deps do
]
end
```
- Run `mix deps.get`
Update depedencies:

```sh
$ mix deps.get
```

## Using PrettyLog

Expand All @@ -39,8 +51,8 @@ config :pretty_log,
## Available Formatters

Following formatters are included:
- PrettyLog.LogfmtFormatter
- PrettyLog.UserFriendlyFormatter
- `PrettyLog.LogfmtFormatter`
- `PrettyLog.UserFriendlyFormatter`

## Formatter Vs Backend

Expand All @@ -50,7 +62,22 @@ Formatter and logger backend are two distinct components.

This library is focused on logs formatting, leaving to you the choice about your favourite backend.

## Copyright and License

Copyright (c) 2019 Astarte

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

## About This Project

This project has been created in order to provide better logs in [Astarte](https://github.com/astarte-platform/astarte).
We are open to any contribution and we encourage adoption of this library, also outside Astarte, in order to provide better logs to everyone.

33 changes: 22 additions & 11 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
defmodule PrettyLog.MixProject do
use Mix.Project

@source_url "https://github.com/ispirata/pretty_log"
@version "0.9.0"

def project do
[
app: :pretty_log,
version: "0.9.0",
version: @version,
elixir: "~> 1.8",
deps: deps(),
description: description(),
package: package(),
source_url: "https://github.com/ispirata/pretty_log"
docs: docs(),
package: package()
]
end

Expand All @@ -20,22 +22,31 @@ defmodule PrettyLog.MixProject do
defp deps do
[
{:logfmt, "~> 3.3"},
{:ex_doc, "~> 0.21", only: :dev, runtime: false}
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false}
]
end

defp description do
"An Elixir log formatter library."
end

defp package do
[
description: "An Elixir log formatter library.",
maintainers: ["Davide Bettio"],
licenses: ["Apache-2.0"],
links: %{
"GitHub" => "https://github.com/ispirata/pretty_log",
"Documentation" => "http://hexdocs.pm/pretty_log/"
"GitHub" => @source_url
}
]
end

defp docs do
[
extras: [
"LICENSE": [title: "License"],
"README.md": [title: "Overview"]
],
main: "readme",
source_url: @source_url,
source_ref: "v#{@version}",
formatters: ["html"]
]
end
end
10 changes: 6 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
%{
"earmark": {:hex, :earmark, "1.4.2", "3aa0bd23bc4c61cf2f1e5d752d1bb470560a6f8539974f767a38923bb20e1d7f", [:mix], [], "hexpm", "5e8806285d8a3a8999bd38e4a73c58d28534c856bc38c44818e5ba85bbda16fb"},
"ex_doc": {:hex, :ex_doc, "0.21.2", "caca5bc28ed7b3bdc0b662f8afe2bee1eedb5c3cf7b322feeeb7c6ebbde089d6", [:mix], [{:earmark, "~> 1.3.3 or ~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f1155337ae17ff7a1255217b4c1ceefcd1860b7ceb1a1874031e7a861b052e39"},
"earmark_parser": {:hex, :earmark_parser, "1.4.15", "b29e8e729f4aa4a00436580dcc2c9c5c51890613457c193cc8525c388ccb2f06", [:mix], [], "hexpm", "044523d6438ea19c1b8ec877ec221b008661d3c27e3b848f4c879f500421ca5c"},
"ex_doc": {:hex, :ex_doc, "0.25.2", "4f1cae793c4d132e06674b282f1d9ea3bf409bcca027ddb2fe177c4eed6a253f", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "5b0c172e87ac27f14dfd152d52a145238ec71a95efbf29849550278c58a393d6"},
"logfmt": {:hex, :logfmt, "3.3.2", "c432765cff9c26cf4ba78cf66ece183e56562dfeba6e2d9f077804cc4c756677", [:mix], [], "hexpm", "8dfc07bf11d362d1ffb11fa34647f4e78dba47247589cc94fd8c9155889c8fcb"},
"makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "a10c6eb62cca416019663129699769f0c2ccf39428b3bb3c0cb38c718a0c186d"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.1", "c90796ecee0289dbb5ad16d3ad06f957b0cd1199769641c961cfe0b97db190e0", [:mix], [], "hexpm", "00e3ebdc821fb3a36957320d49e8f4bfa310d73ea31c90e5f925dc75e030da8f"},
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
"makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"},
}