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 android.test.AndroidTestCase; 20 import android.util.Log; 21 22 /** 23 * 24 * Test Log 25 * 26 */ 27 public class LogTest extends AndroidTestCase{ 28 private static final String TAG = "LogTest"; 29 30 public void testLogOperations() { 31 final String msg = "Test Log operations."; 32 Exception tr = null; 33 try { 34 throw new Exception(); 35 } catch (Exception e) { 36 tr = e; 37 } 38 // println and getStackTraceString are called in e w i d v 39 Log.e(TAG, msg); 40 Log.e(TAG, msg, tr); 41 Log.w(TAG, msg); 42 Log.w(TAG, tr); 43 Log.w(TAG, msg, tr); 44 Log.i(TAG, msg); 45 Log.i(TAG, msg, tr); 46 Log.d(TAG, msg); 47 Log.d(TAG, msg, tr); 48 Log.v(TAG, msg); 49 Log.v(TAG, msg, tr); 50 assertTrue(Log.isLoggable(TAG, Log.INFO)); 51 } 52 } 53