8000 Blame exceptions by axelson · Pull Request #1 · axelson/ring_logger · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Blame exceptions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 46 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9b03554
Bump ex_doc from 0.25.2 to 0.25.5
dependabot[bot] Oct 21, 2021
94b40f0
Bump ex_doc to latest
fhunleth Nov 30, 2021
5d7a174
Allow full configuring under logger application
axelson Nov 27, 2021
adc5976
Merge defaults from old configuration
axelson Nov 29, 2021
37f7696
fix formatting
axelson Nov 29, 2021
da07ac9
rewrite put_all_env to support elixir < 1.9.0
axelson Nov 29, 2021
f6d47d6
v0.8.3 release
fhunleth Nov 30, 2021
2bfeb74
Bump ex_doc from 0.26.0 to 0.27.3
dependabot[bot] Jan 12, 2022
af44b27
Bump ex_doc from 0.27.3 to 0.28.1
dependabot[bot] Feb 21, 2022
9f712a8
Bump ex_doc from 0.28.1 to 0.28.2
dependabot[bot] Feb 24, 2022
f39838b
Bump circular_buffer from 0.4.0 to 0.4.1
dependabot[bot] Mar 11, 2022
f8966de
Colorize grep results
jjcarstens Apr 12, 2022
85be62c
Fix setting colors enabled
jjcarstens Apr 12, 2022
e91fda9
Bump ex_doc from 0.28.2 to 0.28.3
dependabot[bot] Mar 23, 2022
3afb539
v0.8.4 release
jjcarstens Apr 13, 2022
d19d743
Bump ex_doc from 0.28.3 to 0.28.4
dependabot[bot] Apr 28, 2022
24c51f0
Support `:before` and `:after` options in grep
jjcarstens May 25, 2022
7028e36
Support OTP 25
jjcarstens May 25, 2022
c335240
v0.8.5 release
jjcarstens May 25, 2022
cb45f88
Bump dialyxir from 1.1.0 to 1.2.0
dependabot[bot] Jul 21, 2022
0f0dccb
Bump ex_doc from 0.28.4 to 0.28.5
dependabot[bot] Aug 19, 2022
210480f
Fix unicode chardata support
Oct 9, 2022
8ab4232
Add unit test for chardata
fhunleth Oct 9, 2022
8a37041
Bump earmark_parser
fhunleth Oct 9, 2022
2f44f57
Fix typo in comment
fhunleth Oct 9, 2022
e0b0eb4
Fix unit tests for Elixir 1.4
fhunleth Oct 9, 2022
954b8fb
Don't install rebar3 since unneeded and sometimes fails
fhunleth Oct 9, 2022
0f45e6c
Replace more incorrect uses of iodata_to_binary
fhunleth Oct 9, 2022
9dfbbfe
v0.8.6 release
fhunleth Oct 9, 2022
aa608e0
Bump ex_doc from 0.28.5 to 0.28.6
dependabot[bot] Oct 13, 2022
f1bbcce
Bump ex_doc from 0.28.6 to 0.29.0
dependabot[bot] Oct 20, 2022
14fb2fa
Add count_next function (#99)
mnishiguchi Oct 29, 2022
81b801c
Bump ex_doc from 0.29.0 to 0.29.1
dependabot[bot] Nov 21, 2022
e613f41
Require Elixir 1.9 and later; update CI
fhunleth Feb 7, 2023
33ae8c5
Add credo and fix issues (all trivial)
fhunleth Feb 7, 2023
5aef228
Allow for multiple circular buffers based on log level
oestrich Feb 6, 2023
6b454d9
Add a buffers benchmark
oestrich Feb 7, 2023
729045b
Remove state modules
fhunleth Feb 8, 2023
d8f1140
Add missing specs and cleanup
fhunleth Feb 8, 2023
03271e2
Correct entry type
mnishiguchi Nov 11, 2022
634e273
Update circular buffer configuration docs
fhunleth Feb 8, 2023
4d7eb9d
Remove periods in function summaries
fhunleth Feb 8, 2023
032eac6
Add warning for count_next/1
fhunleth Feb 8, 2023
a304a88
v0.9.0 release
fhunleth Feb 8, 2023
f22a87b
Blame exceptions
axelson Sep 25, 2021
ae0c7b1
Add a note to the readme
axelson Sep 25, 2021
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
227 changes: 49 additions & 178 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,190 +1,61 @@
version: 2
version: 2.1

install_elixir: &install_elixir
run:
name: Install Elixir
command: |
wget https://repo.hex.pm/builds/elixir/v$ELIXIR_VERSION.zip
unzip -d /usr/local/elixir v$ELIXIR_VERSION.zip
echo 'export PATH=/usr/local/elixir/bin:$PATH' >> $BASH_ENV

install_hex_rebar: &install_hex_rebar
run:
name: Install hex and rebar
command: |
mix local.hex --force
mix local.rebar --force

install_system_deps: &install_system_deps
run:
name: Install system dependencies
command: |
apt update
apt install -y unzip

defaults: &defaults
working_directory: ~/repo
latest: &latest
pattern: "^1.14.3-erlang-25.*$"

jobs:
build_elixir_1_12_otp_24:
docker:
- image: erlang:24.0
environment:
ELIXIR_VERSION: 1.12.1-otp-24
LC_ALL: C.UTF-8
<<: *defaults
steps:
- checkout
- <<: *install_system_deps
- <<: *install_elixir
- <<: *install_hex_rebar
build-test:
parameters:
tag:
type: string
docker:
- image: hexpm/elixir:<< parameters.tag >>
working_directory: ~/repo
environment:
LC_ALL: C.UTF-8
steps:
- run:
name: Install system dependencies
command: apk add --no-cache build-base
- checkout
- run:
name: Install hex and rebar
command: |
mix local.hex --force
mix local.rebar --force
- restore_cache:
keys:
- v1-mix-cache-{{ checksum "mix.lock" }}
- run: mix deps.get
- run: mix format --check-formatted
- run: mix docs
- run: mix hex.build
- run: mix test
- run: mix dialyzer
- v1-mix-cache-<< parameters.tag >>-{{ checksum "mix.lock" }}
- run: mix deps.get
- run: mix test
- when:
condition:
matches: { <<: *latest, value: << parameters.tag >> }
steps:
- run: mix format --check-formatted
- run: mix deps.unlock --check-unused
- run: mix docs
- run: mix hex.build
- run: mix credo -a --strict
- run: mix dialyzer
- save_cache:
key: v1-mix-cache-{{ checksum "mix.lock" }}
key: v1-mix-cache-<< parameters.tag >>-{{ checksum "mix.lock" }}
paths:
- _build
- deps

build_elixir_1_11_otp_23:
docker:
- image: erlang:23.0.3
environment:
ELIXIR_VERSION: 1.10.4-otp-23
LC_ALL: C.UTF-8
<<: *defaults
steps:
- checkout
- <<: *install_system_deps
- <<: *install_elixir
- <<: *install_hex_rebar
- run: mix deps.get
- run: mix test

build_elixir_1_10_otp_22:
docker:
- image: erlang:22.3.4.1
environment:
ELIXIR_VERSION: 1.10.3-otp-22
LC_ALL: C.UTF-8
<<: *defaults
steps:
- checkout
- <<: *install_system_deps
- <<: *install_elixir
- <<: *install_hex_rebar
- run: mix deps.get
- run: mix test

build_elixir_1_9_otp_22:
docker:
- image: erlang:22.2.8
environment:
ELIXIR_VERSION: 1.9.4-otp-22
LC_ALL: C.UTF-8
<<: *defaults
steps:
- checkout
- <<: *install_system_deps
- <<: *install_elixir
- <<: *install_hex_rebar
- run: mix deps.get
- run: mix test

build_elixir_1_8_otp_22:
docker:
- image: erlang:22.0
environment:
ELIXIR_VERSION: 1.8.2-otp-22
LC_ALL: C.UTF-8
<<: *defaults
steps:
- checkout
- <<: *install_system_deps
- <<: *install_elixir
- <<: *install_hex_rebar
- run: mix deps.get
- run: mix test

build_elixir_1_7_otp_21:
docker:
- image: erlang:21.3
environment:
ELIXIR_VERSION: 1.7.4-otp-21
LC_ALL: C.UTF-8
<<: *defaults
steps:
- checkout
- <<: *install_system_deps
- <<: *install_elixir
- <<: *install_hex_rebar
- run: mix deps.get
- run: mix test

build_elixir_1_6_otp_20:
docker:
- image: erlang:20.3.8
environment:
ELIXIR_VERSION: 1.6.6-otp-20
LC_ALL: C.UTF-8
<<: *defaults
steps:
- checkout
- <<: *install_system_deps
- <<: *install_elixir
- <<: *install_hex_rebar
- run: mix deps.get
- run: mix test

build_elixir_1_5_otp_20:
docker:
- image: erlang:20.3.8
environment:
ELIXIR_VERSION: 1.5.3-otp-20
LC_ALL: C.UTF-8
<<: *defaults
steps:
- checkout
- <<: *install_system_deps
- <<: *install_elixir
- <<: *install_hex_rebar
- run: mix deps.get
- run: MIX_ENV=test mix compile
- run: mix test

build_elixir_1_4_otp_19:
docker:
- image: erlang:19.3
environment:
ELIXIR_VERSION: 1.4.5
LC_ALL: C.UTF-8
<<: *defaults
steps:
- checkout
- <<: *install_system_deps
- <<: *install_elixir
- <<: *install_hex_rebar
- run: mix deps.get
- run: MIX_ENV=test mix compile
- run: mix test

workflows:
version: 2
build_test:
checks:
jobs:
- build_elixir_1_12_otp_24
- 9E7A build_elixir_1_11_otp_23
- build_elixir_1_10_otp_22
- build_elixir_1_9_otp_22
- build_elixir_1_8_otp_22
- build_elixir_1_7_otp_21
- build_elixir_1_6_otp_20
- build_elixir_1_5_otp_20
- build_elixir_1_4_otp_19
- build-test:
name: << matrix.tag >>
matrix:
parameters:
tag: [
1.14.3-erlang-25.2.2-alpine-3.17.0,
1.13.4-erlang-24.3.4-alpine-3.15.3,
1.12.3-erlang-24.3.4-alpine-3.15.3,
1.11.4-erlang-23.3.4.13-alpine-3.15.3,
1.10.4-erlang-23.3.4.18-alpine-3.15.6,
1.9.4-erlang-22.3.4.23-alpine-3.13.6
]
17 changes: 17 additions & 0 deletions .credo.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# .credo.exs
%{
configs: [
%{
name: "default",
strict: true,
checks: [
{Credo.Check.Refactor.MapInto, false},
{Credo.Check.Warning.LazyLogging, false},
{Credo.Check.Readability.LargeNumbers, only_greater_than: 86400},
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, parens: true},
{Credo.Check.Readability.Specs, tags: []},
{Credo.Check.Readability.StrictModuleLayout, tags: []}
]
}
]
}
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
inputs: ["{mix,.credo,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
# Changelog

This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v0.9.0

This latest release removes support for Elixir versions before 1.9.

* Improvements
* Support multiple circular buffers and filtering based on log level. This
makes it possible to separate out debug and info messages so they don't push
out error messages. See the `README.md` for configuration examples. Thanks
to @oestrich for this feature.
* Fixed and added specs throughout

## v0.8.6

* Improvements
* Fixed crashes when converting unicode chardata. Thanks to @x4lldux for this
fix.

## v0.8.5

* Improvements
* `RingLogger.grep/2` supports `:before` and `:after` options
* Support OTP 25

## v0.8.4

* Fixes
* Default color enabled option now correctly evaluated at runtime for the active IO

* Improvements
* `RingLogger.grep` will now highlight matches in the output if color is enabled

## v0.8.3

* Fixes
* Pull all application environment configuration from `:logger, RingLogger`
rather than some from there and some from `:ring_logger`. Adding
configuration under `:ring_logger` is still supported, but prints a
deprecation warning. Thanks to Jason Axelson for this fix.

## v0.8.2

* Improvements
Expand Down
39 changes: 33 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,39 @@ Then configure the logger in your `config/config.exs`:
```elixir
use Mix.Config

# Add the RingLogger backend. This removes the
# default :console backend.
# Add the RingLogger backend. This removes the default :console backend.
config :logger, backends: [RingLogger]

# Set the number of messages to hold in the circular buffer
# Save messages to one circular buffer that holds 1024 entries.
config :logger, RingLogger, max_size: 1024

# You can also configure RingLogger.Client options to be used
# Separate out `:error` and `:warning` messages to their own circular buffer.
# All other log messages are stored in the default circular buffer.
config :logger, RingLogger, buffers: %{
errors: %{
levels: [:error, :warning],
max_size: 1024
}
}

# Specify circular buffers for all log levels. The default circular buffer won't
# be used in this example configuration.
config :logger, RingLogger, buffers: %{
low_priority: %{
levels: [:warning, :notice, :info, :debug],
max_size: 1024
},
high_priority: %{
levels: [:emergency, :alert, :critical, :error],
max_size: 1024
}
]

# You can also configure `RingLogger.Client` options to be used
# with every client by default
config :ring_logger,
config :logger, RingLogger,
application_levels: %{my_app: :error},
color: [debug: :yellow],
colors: [debug: :yellow],
level: :debug
```

Expand Down Expand Up @@ -264,3 +285,9 @@ iex> RingLogger.get
]}
]
```

## Rich Error Messages

To get rich error messages ensure that debugging information is not stripped out of the beam files. On Nerves that might look like editing your `:strip_beams` setting in `mix.exs` to keep `"Dbgi"`:

strip_beams: Mix.env() == :prod or [keep: ["Docs", "Dbgi"]]
Loading
0