Home | History | Annotate | Download | only in cts
      1 /*
      2  * Copyright (C) 2008 The Android Open Source Project
      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 android.util.cts;
     18 
     19 import static org.junit.Assert.assertTrue;
     20 
     21 import android.support.test.filters.SmallTest;
     22 import android.support.test.runner.AndroidJUnit4;
     23 import android.util.Log;
     24 
     25 import org.junit.Test;
     26 import org.junit.runner.RunWith;
     27 
     28 @SmallTest
     29 @RunWith(AndroidJUnit4.class)
     30 public class LogTest {
     31     private static final String TAG = "LogTest";
     32 
     33     @Test
     34     public void testLogOperations() {
     35         final String msg = "Test Log operations.";
     36         Exception tr = null;
     37         try {
     38             throw new Exception();
     39         } catch (Exception e) {
     40             tr = e;
     41         }
     42         // println and getStackTraceString are called in e w i d v
     43         Log.e(TAG, msg);
     44         Log.e(TAG, msg, tr);
     45         Log.w(TAG, msg);
     46         Log.w(TAG, tr);
     47         Log.w(TAG, msg, tr);
     48         Log.i(TAG, msg);
     49         Log.i(TAG, msg, tr);
     50         Log.d(TAG, msg);
     51         Log.d(TAG, msg, tr);
     52         Log.v(TAG, msg);
     53         Log.v(TAG, msg, tr);
     54         assertTrue(Log.isLoggable(TAG, Log.INFO));
     55     }
     56 }
     57