> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liv.tv/llms.txt
> Use this file to discover all available pages before exploring further.

# LevelFilter

> Control SDK logging verbosity from silent to full trace for debugging and production builds.

## What Problem Does This Solve?

During development, you want detailed logs to debug issues—what methods are called, what data is passed, when errors occur. In production, you want minimal logging to avoid performance overhead and log spam.

`LevelFilter` controls how much the LCK SDK logs to the console, letting you dial logging verbosity up for debugging or down for release builds.

## When to Use This

Set `LevelFilter` when:

* **Development:** Use `Debug` or `Trace` to see detailed SDK behavior
* **Testing/QA:** Use `Info` to see important events without noise
* **Production:** Use `Warn` or `Error` to only log problems
* **Release builds:** Use `Off` to disable all SDK logging

***

## Quick Example

```csharp theme={null}
// Development build - verbose logging
#if DEVELOPMENT_BUILD
    LckCore.SetLogLevel(LevelFilter.Debug);
#else
    // Production - errors only
    LckCore.SetLogLevel(LevelFilter.Error);
#endif
```

***

## Log Levels Explained

### Off

**No logging at all.** The SDK produces zero console output.

**When to use:**

* Shipping builds where you don't want any SDK logs
* Performance-critical sections
* Final release to customers

```csharp theme={null}
LckCore.SetLogLevel(LevelFilter.Off);
// SDK will produce no logs
```

***

### Error

**Critical errors only.** Only logs when something breaks.

**When to use:**

* Production/release builds
* You only want to know when things fail
* Minimize log noise

**What you'll see:**

* Initialization failures
* Recording errors
* Permission denials
* Platform incompatibility

```csharp theme={null}
LckCore.SetLogLevel(LevelFilter.Error);
// Example output:
// [LCK ERROR] Failed to start recording: NotEnoughStorageSpace
// [LCK ERROR] Microphone permission denied
```

***

### Warn

**Errors + warnings.** Problems that might cause issues but aren't critical.

**When to use:**

* Staging/beta builds
* You want to catch potential issues before they become errors
* Production with monitoring

**What you'll see:**

* Low storage warnings
* Deprecated API usage
* Suboptimal configurations
* Performance concerns

```csharp theme={null}
LckCore.SetLogLevel(LevelFilter.Warn);
// Example output:
// [LCK WARN] Storage space low (< 500 MB remaining)
// [LCK WARN] Using deprecated method, migrate to XYZ
// [LCK ERROR] Recording failed
```

***

### Info

**Important events.** SDK lifecycle events and state changes.

**When to use:**

* QA/testing builds
* You want visibility into what the SDK is doing
* Troubleshooting user reports

**What you'll see:**

* SDK initialization
* Recording start/stop
* Quality changes
* Camera configuration

```csharp theme={null}
LckCore.SetLogLevel(LevelFilter.Info);
// Example output:
// [LCK INFO] LckCore initialized successfully
// [LCK INFO] Recording started at 1080p60
// [LCK INFO] Quality changed to Medium
// [LCK WARN] Storage low
// [LCK ERROR] Mic permission denied
```

***

### Debug

**Everything + debug details.** Internal SDK operations and parameter values.

**When to use:**

* Active development
* Debugging SDK integration issues
* Understanding SDK behavior
* Reproducing bugs

**What you'll see:**

* Method calls with parameters
* Internal state changes
* Configuration details
* Data flow

```csharp theme={null}
LckCore.SetLogLevel(LevelFilter.Debug);
// Example output:
// [LCK DEBUG] SetActiveCaptureType(Recording)
// [LCK DEBUG] Applying quality option: High (1920x1080, 10Mbps, 60fps)
// [LCK DEBUG] Encoder initialized: H264, bitrate=10485760
// [LCK INFO] Recording started
// [LCK WARN] Storage: 450 MB remaining
```

***

### Trace

**Maximum verbosity.** Frame-by-frame details, extremely detailed logging.

**When to use:**

* Deep debugging of specific issues
* Understanding exact execution flow
* Performance profiling
* Reporting bugs to LIV support

**Warning:** Very high log volume, may impact performance.

**What you'll see:**

* Every frame's processing
* Memory allocations
* Texture updates
* Encoder buffer states
* Network packet details (streaming)

```csharp theme={null}
LckCore.SetLogLevel(LevelFilter.Trace);
// Example output:
// [LCK TRACE] Frame 1245: Capture started
// [LCK TRACE] Frame 1245: Texture copy (1920x1080, 8.2ms)
// [LCK TRACE] Frame 1245: Encoder input queued
// [LCK TRACE] Frame 1245: Audio buffer: 1024 samples
// [LCK DEBUG] Quality check: framerate stable at 60fps
// [LCK INFO] Recording at 00:01:23
```

***

## Recommended Settings by Build Type

| Build Type               | Recommended Level | Rationale                                     |
| ------------------------ | ----------------- | --------------------------------------------- |
| **Editor (Development)** | `Debug`           | See what SDK is doing during integration      |
| **Development Build**    | `Info`            | Track SDK events without overwhelming detail  |
| **QA/Testing Build**     | `Warn`            | Catch warnings before release                 |
| **Staging/Beta**         | `Error`           | Production-like with error visibility         |
| **Release/Production**   | `Off` or `Error`  | Minimize logs for performance and cleanliness |

***

## Common Patterns

### Build-specific logging

```csharp theme={null}
void SetAppropriateLogLevel()
{
    #if UNITY_EDITOR
        // Verbose in editor
        LckCore.SetLogLevel(LevelFilter.Debug);
    #elif DEVELOPMENT_BUILD
        // Important events only
        LckCore.SetLogLevel(LevelFilter.Info);
    #else
        // Errors only in production
        LckCore.SetLogLevel(LevelFilter.Error);
    #endif
    
    Debug.Log($"LCK log level: {GetCurrentLogLevel()}");
}
```

### Runtime toggle (debug menu)

```csharp theme={null}
public class DebugMenu : MonoBehaviour
{
    private LevelFilter currentLevel = LevelFilter.Info;
    
    void OnGUI()
    {
        if (GUILayout.Button("Cycle Log Level"))
        {
            currentLevel = currentLevel switch
            {
                LevelFilter.Off => LevelFilter.Error,
                LevelFilter.Error => LevelFilter.Warn,
                LevelFilter.Warn => LevelFilter.Info,
                LevelFilter.Info => LevelFilter.Debug,
                LevelFilter.Debug => LevelFilter.Trace,
                _ => LevelFilter.Off
            };
            
            LckCore.SetLogLevel(currentLevel);
            Debug.Log($"LCK log level: {currentLevel}");
        }
        
        GUILayout.Label($"Current Level: {currentLevel}");
    }
}
```

### Platform-specific

```csharp theme={null}
void InitializeLCK()
{
    // More verbose logging on desktop for debugging
    var logLevel = Application.platform switch
    {
        RuntimePlatform.WindowsEditor => LevelFilter.Debug,
        RuntimePlatform.OSXEditor => LevelFilter.Debug,
        RuntimePlatform.WindowsPlayer => LevelFilter.Warn,
        RuntimePlatform.OSXPlayer => LevelFilter.Warn,
        RuntimePlatform.Android => LevelFilter.Error,
        RuntimePlatform.IPhonePlayer => LevelFilter.Error,
        _ => LevelFilter.Info
    };
    
    LckCore.SetLogLevel(logLevel);
    Debug.Log($"LCK logging: {logLevel} on {Application.platform}");
}
```

### Temporary verbose logging for debugging

```csharp theme={null}
void DebugRecordingIssue()
{
    // Save current level
    var originalLevel = GetCurrentLogLevel();
    
    // Temporarily enable trace logging
    LckCore.SetLogLevel(LevelFilter.Trace);
    
    // Perform problematic operation
    var result = lckService.StartRecording();
    
    // Restore original level
    LckCore.SetLogLevel(originalLevel);
}
```

***

## Enum Values

| Level   | Value             | Output              | Performance Impact |
| ------- | ----------------- | ------------------- | ------------------ |
| `Off`   | Silent            | Nothing             | None               |
| `Error` | Errors only       | Critical failures   | Minimal            |
| `Warn`  | Errors + warnings | Potential problems  | Minimal            |
| `Info`  | Important events  | SDK lifecycle       | Low                |
| `Debug` | Detailed info     | Internal operations | Moderate           |
| `Trace` | Everything        | Frame-by-frame      | High               |

***

## API Reference

### Set Log Level

```csharp theme={null}
void LckCore.SetLogLevel(LevelFilter level)
```

**Parameters:**

* `level` — Desired logging verbosity

**Example:**

```csharp theme={null}
LckCore.SetLogLevel(LevelFilter.Debug);
```

***

## Performance Considerations

<Warning>
  **Trace logging can impact performance** — especially at high framerates (60+ fps). Use only for debugging specific issues.
</Warning>

**Impact by level:**

* `Off`, `Error`, `Warn` — Negligible impact
* `Info` — Very low impact (under 1% typical)
* `Debug` — Low impact (1-3% typical)
* `Trace` — Moderate impact (5-10% possible)

**Best practice:** Ship production builds with `Error` or `Off`.

***

## Debugging Tips

### Capture logs to file

```csharp theme={null}
void Start()
{
    // Enable detailed logging for bug reports
    LckCore.SetLogLevel(LevelFilter.Debug);
    
    // Unity captures to log file automatically
    Debug.Log("Log location: " + Application.persistentDataPath);
}
```

### Conditional compilation

```csharp theme={null}
#if DEBUG_LCK
    LckCore.SetLogLevel(LevelFilter.Trace);
#else
    LckCore.SetLogLevel(LevelFilter.Error);
#endif
```

Define `DEBUG_LCK` in Player Settings → Scripting Define Symbols when debugging.

***

## Best Practices

<Check>
  **Set early** — Configure log level in `Awake()` before SDK initialization
</Check>

<Check>
  **Build-specific** — Use preprocessor directives for different builds
</Check>

<Check>
  **Ship clean** — Use `Error` or `Off` in production
</Check>

<Check>
  **Debug temporarily** — Increase verbosity when debugging, restore after
</Check>

<Warning>
  **Don't leave Trace enabled** — High performance cost, huge log files
</Warning>

***

## Related

* [LckCore](/api-reference/unity/classes/core/LckCore) — Where to set log level
* [Debugging Guide](https://docs.liv.tv/api-reference/unity/structs/core/GameInfo#why-this-information-matters) — Troubleshooting SDK issues
* [Performance Optimization](https://docs.liv.tv/api-reference/unity/structs/CameraTrackDescriptor#performance-tips) — Performance best practices
