• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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.tools.common
18 
19 class ConsoleLogger : ILogger {
vnull20     override fun v(tag: String, msg: String) = println("(V) $tag $msg")
21 
22     override fun d(tag: String, msg: String) = println("(D) $tag $msg")
23 
24     override fun i(tag: String, msg: String) = println("(I) $tag $msg")
25 
26     override fun w(tag: String, msg: String) = println("(W) $tag $msg")
27 
28     override fun e(tag: String, msg: String, error: Throwable?) {
29         println("(e) $tag $msg $error")
30         error?.printStackTrace()
31     }
32 
withTracingnull33     override fun <T> withTracing(name: String, predicate: () -> T): T =
34         try {
35             println("(withTracing#start) $name")
36             predicate()
37         } finally {
38             println("(withTracing#end) $name")
39         }
40 }
41