Skip to content

Latest commit

 

History

History
78 lines (56 loc) · 1.99 KB

MIGRATION_GUIDE.md

File metadata and controls

78 lines (56 loc) · 1.99 KB

Migration Guide

v1.x to v2.0.0

Phoenix users:

  1. Attach the new logger through telemetry events in your project's application.ex file:

    # lib/pixie/application.ex
    def start(_type, _args) do
      children = [
        # ...
      ]
    
      #
      # Add the line below:
      #
      :ok = Logster.attach_phoenix_logger()
    
      opts = [strategy: :one_for_one, name: MyApp.Supervisor]
      Supervisor.start_link(children, opts)
    end
  2. Locate the line installing Logster.Plugs.Logger in your endpoint.ex file.

    plug Logster.Plugs.Logger,
      # Configuration options such as those below might not be present
      formatter: Logster.Plugs.JSONFormatter,
      allowed_headers: ["content-type"],
      excludes: [:params]
  3. If configuration options were passed to Logster.Plugs.Logger, move them to config.exs:

    config :logster,
      formatter: :json,
      headers: ["content-type"],
      excludes: [:params]

    NOTE: allowed_headers option has been renamed to headers

  4. Remove the line installing Logster.Plugs.Logger from your endpoint.ex file.

  5. Locate any calls to Logster.Plugs.ChangeLogLevel and use Logster.ChangeConfig plug instead:

    -  plug Logster.Plugs.ChangeLogLevel, [to: :debug]
    +  plug Logster.ChangeConfig, [status_2xx_level: :debug]
  6. Add the following to config.exs to disable the default Phoenix logger:

    config :phoenix, :logger, false

Plug users:

  1. Move any configuration options passed to Logster.Plugs.Logger to config.exs (See above section for more information).

  2. Locate any calls to Logster.Plugs.Logger and rename it to Logster.Plug

    -  plug Logster.Plugs.Logger
    +  plug Logster.Plug
  3. Locate any calls to Logster.Plugs.ChangeLogLevel and use Logster.ChangeConfig instead.

    -  plug Logster.Plugs.ChangeLogLevel, [to: :debug]
    +  plug Logster.ChangeConfig, [status_2xx_level: :debug]