davidliu
Committed by GitHub

Fix log level order (#452)

1 /* 1 /*
2 - * Copyright 2023 LiveKit, Inc. 2 + * Copyright 2023-2024 LiveKit, Inc.
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
@@ -20,8 +20,8 @@ import android.util.Log @@ -20,8 +20,8 @@ import android.util.Log
20 20
21 enum class LoggingLevel { 21 enum class LoggingLevel {
22 VERBOSE, 22 VERBOSE,
23 - INFO,  
24 DEBUG, 23 DEBUG,
  24 + INFO,
25 WARN, 25 WARN,
26 ERROR, 26 ERROR,
27 WTF, 27 WTF,
  1 +/*
  2 + * Copyright 2024 LiveKit, Inc.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +package io.livekit.android.util
  18 +
  19 +import io.livekit.android.LiveKit
  20 +import org.junit.Assert.assertFalse
  21 +import org.junit.Assert.assertTrue
  22 +import org.junit.Test
  23 +
  24 +class LKLogTest {
  25 +
  26 + @Test
  27 + fun log() {
  28 + var called = false
  29 + LiveKit.loggingLevel = LoggingLevel.INFO
  30 + LKLog.log(LoggingLevel.ERROR) { called = true }
  31 + assertTrue(called)
  32 + }
  33 +
  34 + @Test
  35 + fun noLog() {
  36 + var called = false
  37 + LiveKit.loggingLevel = LoggingLevel.OFF
  38 + LKLog.log(LoggingLevel.VERBOSE) { called = true }
  39 + assertFalse(called)
  40 + }
  41 +}