Steve Elliott | 1ba1b7c | 2020-05-05 14:16:32 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 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 com.android.systemui.statusbar.notification.stack |
| 18 | |
| 19 | import com.android.systemui.log.LogBuffer |
| 20 | import com.android.systemui.log.LogLevel |
| 21 | import com.android.systemui.log.dagger.NotificationSectionLog |
| 22 | import javax.inject.Inject |
| 23 | import javax.inject.Singleton |
| 24 | |
| 25 | private const val TAG = "NotifSections" |
| 26 | |
| 27 | @Singleton |
| 28 | class NotificationSectionsLogger @Inject constructor( |
| 29 | @NotificationSectionLog private val logBuffer: LogBuffer |
| 30 | ) { |
| 31 | |
| 32 | fun logStartSectionUpdate(reason: String) = logBuffer.log( |
| 33 | TAG, |
| 34 | LogLevel.DEBUG, |
| 35 | { str1 = reason }, |
| 36 | { "Updating section boundaries: $reason" } |
| 37 | ) |
| 38 | |
| 39 | fun logStr(str: String) = logBuffer.log( |
| 40 | TAG, |
| 41 | LogLevel.DEBUG, |
| 42 | { str1 = str }, |
| 43 | { str1 ?: "" } |
| 44 | ) |
| 45 | |
| 46 | fun logPosition(position: Int, label: String) = logBuffer.log( |
| 47 | TAG, |
| 48 | LogLevel.DEBUG, |
| 49 | { |
| 50 | int1 = position |
| 51 | str1 = label |
| 52 | }, |
| 53 | { "$int1: $str1" } |
| 54 | ) |
| 55 | } |