Nebo15 / logger_json

JSON logger formatter with support for Google Cloud, DataDog and other for Elixir.
https://nebo15.github.io/logger_json/
MIT License
242 stars 94 forks source link

Compilation Error: LoggerJSON.Formatter.Plug is not loaded #117

Closed bunnylushington closed 6 months ago

bunnylushington commented 6 months ago

Hi -- In a new project with only {:logger_json, "~> 6.0"} added to the mix.exs compilation fails:

❯ mix deps.get           
Resolving Hex dependencies...
Resolution completed in 0.03s
New:
  jason 1.4.1
  logger_json 6.0.0
* Getting logger_json (Hex package)
* Getting jason (Hex package)

❯ mix compile       
==> jason
Compiling 10 files (.ex)
Generated jason app
==> logger_json
Compiling 17 files (.ex)
    error: module LoggerJSON.Formatter.Plug is not loaded and could not be found. This may be happening because the module you are trying to load directly or indirectly depends on the current module
    │
 45 │   import LoggerJSON.Formatter.{MapBuilder, DateTime, Message, Metadata, Code, Plug, RedactorEncoder}
    │   ^
    │
    └─ lib/logger_json/formatters/datadog.ex:45:3: LoggerJSON.Formatters.Datadog (module)

    error: module LoggerJSON.Formatter.Plug is not loaded and could not be found. This may be happening because the module you are trying to load directly or indirectly depends on the current module
    │
 92 │   import LoggerJSON.Formatter.{MapBuilder, DateTime, Message, Metadata, Code, Plug, RedactorEncoder}
    │   ^
    │
    └─ lib/logger_json/formatters/google_cloud.ex:92:3: LoggerJSON.Formatters.GoogleCloud (module)

    error: module LoggerJSON.Formatter.Plug is not loaded and could not be found. This may be happening because the module you are trying to load directly or indirectly depends on the current module
    │
 90 │   import LoggerJSON.Formatter.{MapBuilder, DateTime, Message, Metadata, Plug, RedactorEncoder}
    │   ^
    │
    └─ lib/logger_json/formatters/elastic.ex:90:3: LoggerJSON.Formatters.Elastic (module)

    error: module LoggerJSON.Formatter.Plug is not loaded and could not be found. This may be happening because the module you are trying to load directly or indirectly depends on the current module
    │
 18 │   import LoggerJSON.Formatter.{MapBuilder, DateTime, Message, Metadata, Plug, RedactorEncoder}
    │   ^
    │
    └─ lib/logger_json/formatters/basic.ex:18:3: LoggerJSON.Formatters.Basic (module)

== Compilation error in file lib/logger_json/formatters/datadog.ex ==
** (CompileError) lib/logger_json/formatters/datadog.ex: cannot compile module LoggerJSON.Formatters.Datadog (errors have been logged)

could not compile dependency :logger_json, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile logger_json --force", update it with "mix deps.update logger_json" or clean it with "mix deps.clean logger_json"

1 ❯ elixir --version            
Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]

Elixir 1.16.1 (compiled with Erlang/OTP 26)

The obvious work around is to include Plug as a dep but it seems like LoggerJSON.Formatter.Plug was written to account for its absence.

AndrewDryga commented 6 months ago

Fixed in 6.0.1