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 com.android.federatedcompute.services.training.jni;
18 
19 import javax.annotation.Nullable;
20 
21 /**
22  * This class offers logging functionality to c++ code. It will be used by
23  * //external/federatedcompute/fcp/client/log_manager.h.
24  */
25 public interface LogManager {
26 
27     /**
28      * Called to log a {@link com.google.android.libraries.micore.learning.proto.ProdDiagCode}.
29      *
30      * @param prodDiagCode a serialized ProdDiagCode.
31      */
logProdDiag(int prodDiagCode)32     void logProdDiag(int prodDiagCode);
33 
34     /**
35      * Called to log a {@link com.google.android.libraries.micore.learning.proto.DebugDiagCode}.
36      *
37      * @param debugDiagCode a serialized DebugDiagCode.
38      */
logDebugDiag(int debugDiagCode)39     void logDebugDiag(int debugDiagCode);
40 
41     /**
42      * Like {@link #logToLongHistogram(int, int, int, int, String, long)}, but without attaching a
43      * model identifier.
44      */
logToLongHistogram( int histogramCounterCode, int executionIndex, int epochIndex, int dataSourceType, long value)45     void logToLongHistogram(
46             int histogramCounterCode,
47             int executionIndex,
48             int epochIndex,
49             int dataSourceType,
50             long value);
51 
52     /** Called to log a long value, by adding it to an annotated histogram. */
logToLongHistogram( int histogramCounterCode, int executionIndex, int epochIndex, int dataSourceType, @Nullable String modelIdentifier, long value)53     void logToLongHistogram(
54             int histogramCounterCode,
55             int executionIndex,
56             int epochIndex,
57             int dataSourceType,
58             @Nullable String modelIdentifier,
59             long value);
60 }
61