Current section

53 Versions

Jump to

Compare versions

5 files changed
+23 additions
-4 deletions
  @@ -2,6 +2,12 @@
2 2
3 3 [v2.x.x -> v3.x.x upgrade guide](/upgrade_guides/version_3_upgrade_guide.md)
4 4
5 + ## v3.3.4
6 +
7 + - Add support for logging via `Logger`.
8 + - Fix some deprecation warnings
9 + - Update github workflow to work again
10 +
5 11 ## v3.3.3
6 12
7 13 - Fix crash when logging binary values that aren't printable strings, by base64
  @@ -409,7 +409,10 @@ ProvisionedThroughput as `[ReadCapacityUnits, WriteCapacityUnits]`, for the Sche
409 409
410 410 #### Logging Configuration
411 411
412 - The adapter's logging options are configured during compile time, and can be altered in the application's configuration files (`config/config.exs`, `config/dev.exs`, `config/test.exs` and `config/test.exs`). To enable logging in colour, the `MIX_ENV` environment variable must be explicitly exported as `dev` during compilation.
412 + As of 3.3.4, setting the `use_logger` configuration option to `true` will to write logs using Elixir's built-in `Logger` system. This setting causes all other log-related settings below to be ignored, and
413 + instead has behaviour dictated by `Logger`'s configuration.
414 +
415 + If `use_logger` is not set, the adapter's logging options are configured during compile time, and can be altered in the application's configuration files (`config/config.exs`, `config/dev.exs`, `config/test.exs` and `config/test.exs`). To enable logging in colour, the `MIX_ENV` environment variable must be explicitly exported as `dev` during compilation.
413 416
414 417 We provide a few informational log lines, such as which adapter call is being processed, as well as the table, lookup fields, and options detected. Configure an optional log path to have the messages recorded on file.
  @@ -46,4 +46,4 @@
46 46 {<<"optional">>,false},
47 47 {<<"repository">>,<<"hexpm">>},
48 48 {<<"requirement">>,<<"~> 1.6">>}]]}.
49 - {<<"version">>,<<"3.3.3">>}.
49 + {<<"version">>,<<"3.3.4">>}.
  @@ -21,6 +21,8 @@ defmodule Ecto.Adapters.DynamoDB do
21 21 alias Ecto.Query.BooleanExpr
22 22 alias ExAws.Dynamo
23 23
24 + require Logger
25 +
24 26 @pool_opts [:timeout, :pool_size, :migration_lock]
25 27
26 28 # DynamoDB will reject attempts to batch write more than 25 records at once
  @@ -1654,6 +1656,14 @@ defmodule Ecto.Adapters.DynamoDB do
1654 1656 Logs message to console and optionally to file. Log levels, colours and file path may be set in configuration (details in README.md).
1655 1657 """
1656 1658 def ecto_dynamo_log(level, message, attributes \\ %{}, opts \\ []) do
1659 + if Confex.get_env(:ecto_adapters_dynamodb, :use_logger) do
1660 + Logger.log(level, message, attributes)
1661 + else
1662 + write_console_log(level, message, attributes, opts)
1663 + end
1664 + end
1665 +
1666 + defp write_console_log(level, message, attributes, opts) do
1657 1667 log_levels = Confex.get_env(:ecto_adapters_dynamodb, :log_levels) || [:info]
1658 1668
1659 1669 if level in log_levels do
  @@ -4,7 +4,7 @@ defmodule Ecto.Adapters.DynamoDB.Mixfile do
4 4 def project do
5 5 [
6 6 app: :ecto_adapters_dynamodb,
7 - version: "3.3.3",
7 + version: "3.3.4",
8 8 elixir: "~> 1.10",
9 9 build_embedded: Mix.env() == :prod,
10 10 start_permanent: Mix.env() == :prod,
  @@ -63,7 +63,7 @@ defmodule Ecto.Adapters.DynamoDB.Mixfile do
63 63 {:hackney, "~> 1.6"},
64 64 {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
65 65 {:eqc_ex, "~> 1.4.2", only: [:dev, :test], runtime: false},
66 - {:ex_doc, "~> 0.28.0", only: :dev, runtime: false}
66 + {:ex_doc, "~> 0.29.1", only: :dev, runtime: false}
67 67 ]
68 68 end