# `KeenAuth.Logger`
[🔗](https://github.com/KeenMate/keen_auth/blob/main/lib/keen_auth/logger.ex#L1)

Categorized logging for KeenAuth with compile-time purging support.

## Categories

- `AUTH` - Authentication flow (authorize redirect, callback handling)
- `MAPPER` - User data mapping and normalization
- `PROCESSOR` - Business logic processing
- `STORAGE` - Session/token storage operations
- `SECURITY` - Security validations (redirect URLs, input validation)
- `CONFIG` - Configuration loading and validation

## Usage

```elixir
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`:

```elixir
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:

```elixir
# Set KeenAuth logs to debug level
Logger.put_module_level(KeenAuth.Logger, :debug)

# Or configure in config
config :logger, :keen_auth,
  level: :debug
```

# `category`

```elixir
@type category() :: :auth | :mapper | :processor | :storage | :security | :config
```

# `debug`
*macro* 

Logs a debug message with category prefix.

Debug logs are typically stripped from production builds via compile_time_purge_matching.

# `error`
*macro* 

Logs an error message with category prefix.

# `info`
*macro* 

Logs an info message with category prefix.

# `warn`
*macro* 

Logs a warning message with category prefix.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
