记录器不工作Elixir

sra*_*ppa 5 logging elixir phoenix-framework

我正在尝试使用Logger.debug/1我的网络项目.即使我确实添加了/ myApp/config中的配置文件(config.exs),我也无法通过此错误消息.

** (CompileError) web/controllers/api/app_controller.ex:36: you must require Logger before invoking the macro Logger.debug/1
Run Code Online (Sandbox Code Playgroud)

我在最后添加了这个特定的配置.

  config :logger,
    backends: [:console],
    compile_time_purge_level: :info
Run Code Online (Sandbox Code Playgroud)

我从http://elixir-lang.org/docs/master/logger/Logger.html获得了帮助

Zep*_*ock 13

您需要添加require Logger模块定义,例如,在之后defmodule AAA...

例如:https://github.com/22cans/exsyslog/blob/2b9ea2be7d7fcc17eab061425b6cd4fad8643996/examples/example1/lib/example1.ex