Categorized logging for KeenAuth with compile-time purging support.
Categories
AUTH- Authentication flow (authorize redirect, callback handling)MAPPER- User data mapping and normalizationPROCESSOR- Business logic processingSTORAGE- Session/token storage operationsSECURITY- Security validations (redirect URLs, input validation)CONFIG- Configuration loading and validation
Usage
require KeenAuth.Logger, as: Log
Log.debug(:auth, "Starting OAuth flow", provider: :github)
Log.info(:mapper, "Mapped user", user_id: user.id)
Log.warn(:security, "Rejected redirect URL", url: url)
Log.error(:processor, "Authentication failed", reason: reason)Compile-Time Purging
Debug logs can be completely removed from production builds by configuring
Logger's compile-time purge level in your config/prod.exs:
config :logger,
compile_time_purge_matching: [
[level_lower_than: :info]
]This removes all :debug level logs at compile time - zero runtime overhead.
Runtime Control
You can also control log levels at runtime:
# Set KeenAuth logs to debug level
Logger.put_module_level(KeenAuth.Logger, :debug)
# Or configure in config
config :logger, :keen_auth,
level: :debug
Summary
Functions
Logs a debug message with category prefix.
Logs an error message with category prefix.
Logs an info message with category prefix.
Logs a warning message with category prefix.
Types
Functions
Logs a debug message with category prefix.
Debug logs are typically stripped from production builds via compile_time_purge_matching.
Logs an error message with category prefix.
Logs an info message with category prefix.
Logs a warning message with category prefix.