# 로그 레벨 설정

## 1. 개요

디버깅 편의를 위해 단계별 로그를 지원합니다. 목적에 맞게 로그 레벨을 설정해서 동작 로그를 확인 가능합니다.\
SDK가 지원하는 로그 레벨은 다음과 같습니다.

* none
* error
* warning
* info (기본값)
* debug
* verbose

각 레벨은 직관적인 이름에 맞는 로그를 출력하며, none은 로그를 출력하지 않습니다. 설정된 단계와 상위 단계의 로그가 모두 출력됩니다.

예를들어, 로그 레벨을 info로 설정할 경우 info, warning, error 에 해당하는 로그가 출력됩니다.

{% hint style="info" %}
로그 레벨 기본값은 info 입니다. 개발 단계에서 디버깅이 필요할 경우 debug 또는 verbose로 설정해주세요.
{% endhint %}

## 2. 설정 방법

{% tabs %}
{% tab title="IOS - Swift" %}

<pre class="language-swift"><code class="lang-swift">// xcode 콘솔에서 com.marketap.sdk 로 마켓탭 로그 subsystem을 필터할 수 있습니다.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    // initialize 이전에 설정해야 초기화 관련 로그에도 반영됩니다.
<strong>    Marketap.setLogLevel(.debug)
</strong>    // ...
}

</code></pre>

{% endtab %}

{% tab title="IOS - objc" %}

```
// verbose: 0, debug: 1 ...

[Marketap setLogLevelRaw:2];
```

{% endtab %}

{% tab title="Android - Kotlin" %}

```kotlin
import com.marketap.sdk.Marketap
import com.marketap.sdk.model.external.MarketapLogLevel

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        // Logcat에서 MarketapSDK 태그로 마켓탭 로그를 필터할 수 있습니다.
        Marketap.setLogLevel(MarketapLogLevel.VERBOSE)
        // ...
    }
}
```

{% endtab %}

{% tab title="Flutter - Dart" %}

```dart
import 'package:flutter/widgets.dart';
import 'package:marketap_sdk/marketap_sdk.dart';

Future main() async { 
    WidgetsFlutterBinding.ensureInitialized();
    // initialize 이전에 설정해야 초기화 관련 로그에도 반영됩니다.
    await Marketap.setLogLevel(MarketapLogLevel.debug);
    await Marketap.initialize('PROJECT_ID');

    runApp(const MyApp());
}
```

{% endtab %}

{% tab title="React Native- Typescript" %}

<pre class="language-typescript"><code class="lang-typescript">import React, {useEffect} from 'react';
import Marketap, {MarketapLogLevel} from 'react-native-marketap-sdk';

export default function App() {
  useEffect(() => {
    const initialize = async () => {
        try {
          // initialize 이전에 설정해야 초기화 관련 로그에도 반영됩니다.
<strong>          Marketap.setLogLevel(MarketapLogLevel.VERBOSE);
</strong>          // ...
        } catch (error) {
          console.error('Marketap setup failed:', error);
        }
      };

      initialize();
  }, []);

  return null;
}
</code></pre>

{% endtab %}
{% endtabs %}
