aboutsummaryrefslogtreecommitdiffstats
path: root/android/src/main/java/org/whispersystems/libaxolotl/util/AndroidAxolotlLogger.java
blob: 302c08a443b1b99cfce94cd680843af7ffcffd59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package org.whispersystems.libaxolotl.util;

import android.util.Log;
import android.util.SparseIntArray;

import org.whispersystems.libaxolotl.logging.AxolotlLogger;

public class AndroidAxolotlLogger implements AxolotlLogger {

  private static final SparseIntArray PRIORITY_MAP = new SparseIntArray(5) {{
    put(AxolotlLogger.INFO, Log.INFO);
    put(AxolotlLogger.ASSERT, Log.ASSERT);
    put(AxolotlLogger.DEBUG, Log.DEBUG);
    put(AxolotlLogger.VERBOSE, Log.VERBOSE);
    put(AxolotlLogger.WARN, Log.WARN);

  }};

  @Override
  public void log(int priority, String tag, String message) {
    int androidPriority = PRIORITY_MAP.get(priority, Log.WARN);
    Log.println(androidPriority, tag, message);
  }
}