Skip to content

Releases: Nebo15/logger_json

7.0.4

14 Jul 15:32
1524672

Choose a tag to compare

What's Changed

  • Add indentation to the code snippet for docs by @RudolfMan in #160
  • Google Cloud: Handle non-binary values in format_affected_user/1 by @raulpe7eira in #161

Full Changelog: 7.0.3...7.0.4

7.0.3

13 May 19:05
a043679

Choose a tag to compare

What's Changed

  • Format metadata[:file] as string in Formatters.Basic by @smaximov in #159

New Contributors

Full Changelog: 7.0.2...7.0.3

7.0.2

30 Apr 21:49
6e0b5ca

Choose a tag to compare

What's Changed

  • Datadog: report error.kind and error.stack for non-crash error+ logs by @aloukissas in #157

New Contributors

Full Changelog: 7.0.1...7.0.2

7.0.1: Allow using config tuples from 6.0

22 Apr 16:23
c0bcd29

Choose a tag to compare

This release restores support for the {FormatterModule, opts} tuple syntax in your config/config.exs, so upgrading from v6 to v7 won’t break existing setups. We added it mainly for users who configure their logger at compile‑time - before new/1 (or any application/dependencies code) is available.

That said, tuple‑based configs are invoked on every log entry, so it’s still best practice to move your formatter setup into config/runtime.exs where it runs once at startup. See 7.0.0 release notes for instructions.

7.0.0

06 Apr 21:09
59660c9

Choose a tag to compare

What's Changed

  • JSON encoder can be used with Elixir 1.18 by @altjohndev #146
  • Add Formatter.new/1 callback to simplify creating and configuring formatters by @ruslandoga #145. An additional benefit of this fix is that now the formatter configuration is only built once and not on each logger call, which should improve performance for some of the logger features. A similar Redactor.new/1 is also added to redactors behaviour.
  • Fixed a crash when handling improper lists by @martosaur in #149
  • Fixed a crash in LoggerJSON.Formatters.Datadog when logging GenServer crash reports by @wjwitek #148
  • Basic formatter now includes module.function/airty in the logged messages by @ppeerttu #138
  • GoogleCloud formatter now will attempt to read project_id from environment variables if it's not set explicitly
  • GoogleCloud formatter will report all :emergency, :alert, :critical and :error messages to Google Cloud Error Reporter by default
  • Binary encoder performance is improved (thanks to @josevalim for suggestions)

Upgrade instructions

Use new/1 in config/runtime.exs to set up the formatter:

config :logger, :default_handler,
--   formatter: {LoggerJSON.Formatters.Basic, [metadata: [:request_id]]}
++   formatter: LoggerJSON.Formatters.Basic.new(metadata: [:request_id])

Notice that the application and dependencies code are not available in config.exs so if it's where you configured the logging, you have two options:

  1. Move it to runtime.exs. This one is recommended because it will also reduce the amount of work the logger needs to do for each log entry;
  2. Upgrade to v7.0.1 and leave everything as is.

or in application.ex

-- :logger.update_handler_config(:default, :formatter, {Basic, []})
++ formatter = LoggerJSON.Formatters.Basic.new()
++ :logger.update_handler_config(:default, :formatter, formatter)

6.2.1

17 Sep 05:46
584a624

Choose a tag to compare

What's Changed

Full Changelog: 6.2.0...6.2.1

6.2.0

26 Aug 19:56
17025e0

Choose a tag to compare

6.0.3

29 May 16:41
ab3a4e8

Choose a tag to compare

  • Improve exception structure when logged using Elastic formatter;
  • Document usage of the crash_reason metadata key across formatters.

6.0.2

24 May 16:31
2432081

Choose a tag to compare

Bugs

  • Do not crash when metadata is set to nil, we will assume that is an empty list instead;
  • Elastic logger did not write message and other keys when a conn was present in the metadata.

6.0.1

21 May 23:20
1b2baf1

Choose a tag to compare

  • Fixed an issue where LoggerJSON will not compile in projects where Plus or Ecto are not added as a dependency