Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
[changelog]
changed: min version
changed: add travis config with matrix tests
  • Loading branch information
OldhamMade committed Jun 18, 2021
1 parent c56d0c8 commit 195fcfd
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 24 deletions.
50 changes: 48 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
language: elixir

elixir:
- '1.8.1'
- '1.9'
otp_release:
- '21.1.1'
- '22.0.3'

matrix:
include:
- elixir: '1.3'
otp_release: '18.3'
- elixir: '1.3'
otp_release: '19.0'
- elixir: '1.4'
otp_release: '18.3'
- elixir: '1.4'
otp_release: '19.0'
- elixir: '1.4'
otp_release: '20.0'
- elixir: '1.5'
otp_release: '18.3'
- elixir: '1.5'
otp_release: '19.0'
- elixir: '1.5'
otp_release: '20.0'
- elixir: '1.6'
otp_release: '18.3'
- elixir: '1.6'
otp_release: '19.0'
- elixir: '1.6'
otp_release: '20.0'
- elixir: '1.6'
otp_release: '21.0'
- elixir: '1.7'
otp_release: '20.0'
- elixir: '1.7'
otp_release: '21.0'
- elixir: '1.7'
otp_release: '22.0'
- elixir: '1.8'
otp_release: '20.0'
- elixir: '1.8'
otp_release: '21.0'
- elixir: '1.8'
otp_release: '22.0'
- elixir: '1.9'
otp_release: '20.0'
- elixir: '1.9'
otp_release: '21.0'
- elixir: '1.9'
otp_release: '22.0'
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# LoggerEtsBackend

[![current build status on Travis-CI.org][build_status]][1]
[![current build status on Travis-CI.org](https://travis-ci.org/OldhamMade/logger_ets_backend.svg?branch=master)][1]

A simple `Logger` backend which writes logs to an ETS table.
It does not create or manage the table for you; you must do
this external to the logging app.
A simple `Logger` backend which writes log entries to an ETS table.
It does not create or manage the table for you; you must do this
external to the logging app.

`LoggerEtsBackend` borrows heavily from [`LoggerFileBackend`][2], and
therefore acts much the same way.
Expand All @@ -13,20 +13,20 @@ therefore acts much the same way.

The primary use-case for this backend is _not_ for persistent logs,
but for temporary logs that may need to be inspected at run-time by
the system itself. By pushing log messages to an ETS table, data
can be quickly searched using `match_spec`s based on message contents
or the metadata stored along with the entry.
the system itself. By pushing log messages to an ETS table, data can
be quickly searched using `match_spec`s based on message contents or
the metadata stored along with the entry.

## Configuration

`LoggerEtsBackend` is a custom backend for the elixir `:logger`
application. This backend can only log to a single ETS table, so there
must be one `:logger` backend configured for each log file we need. Each
backend has a name like `{LoggerEtsBackend, id}`, where `id` is any
elixir term (usually an atom).
must be one `:logger` backend configured for each log file we
need. Each backend has a name like `{LoggerEtsBackend, id}`, where
`id` is any elixir term (usually an atom).

**Note:** tables use for logging are recommented to be configured with the
`:ordered_set` and `:public` options.
**Note:** tables use for logging are recommented to be configured with
the `:ordered_set` and `:public` options.

### Configuration Example

Expand All @@ -47,7 +47,8 @@ config :logger, :critical_log,
* `table` - the table name to push log tuples to
* `level` - the logging level for the backend
* `metadata` - the metadata to include
* `metadata_filter` - metadata terms which must be present in order to log
* `metadata_filter` - metadata terms which must be present in order to
log

**Note:** It is recommended that `metadata_filter` is set for this
backend, to ensure only a small subset of log entries are captured.
Expand Down Expand Up @@ -101,7 +102,8 @@ config :logger, :info,
#### Filtering logging by specifying metadata terms

This example only logs `:info` statements originating from the `:ui`
OTP app. The `:application` metadata key is auto-populated by `Logger`.
OTP app. The `:application` metadata key is auto-populated by
`Logger`.

```elixir
config :logger,
Expand All @@ -116,4 +118,3 @@ config :logger, :ui,

[1]: https://travis-ci.org/OldhamMade/logger_ets_backend
[2]: https://github.com/onkel-dirtus/logger_file_backend
[build_status]: https://travis-ci.org/OldhamMade/logger_ets_backend.svg?branch=master
3 changes: 1 addition & 2 deletions lib/logger_ets_backend.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
defmodule LoggerEtsBackend do
@moduledoc """
"""
@moduledoc false

@behaviour :gen_event

Expand Down
21 changes: 16 additions & 5 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
defmodule LoggerEtsBackend.MixProject do
use Mix.Project

@version "0.0.2"
@github "https://github.com/OldhamMade/logger_ets_backend"

def project do
[
app: :logger_ets_backend,
version: "0.0.1",
elixir: "~> 1.8",
version: @version,
elixir: "~> 1.3",
description: description(),
package: package(),
deps: deps()
deps: deps(),
docs: docs()
]
end

Expand All @@ -25,15 +29,22 @@ defmodule LoggerEtsBackend.MixProject do
end

defp description() do
"A simple `Logger` backend which writes logs to an ETS table."
"A simple `Logger` backend which writes log entries to an ETS table."
end

defp package() do
[
name: "logger_ets_backend",
files: ~w(lib .formatter.exs mix.exs README.md LICENSE CHANGELOG.md),
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/OldhamMade/logger_ets_backend"}
links: %{"GitHub" => @github}
]
end

defp docs do
[extras: ["README.md"],
main: "readme",
source_ref: "v#{@version}",
source_url: @github]
end
end
7 changes: 7 additions & 0 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
%{
"earmark": {:hex, :earmark, "1.3.2", "b840562ea3d67795ffbb5bd88940b1bed0ed9fa32834915125ea7d02e35888a5", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.20.2", "1bd0dfb0304bade58beb77f20f21ee3558cc3c753743ae0ddbb0fd7ba2912331", [:mix], [{:earmark, "~> 1.3", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
"makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
"makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm"},
}

0 comments on commit 195fcfd

Please sign in to comment.