1 /*
2  * Copyright (C) 2016 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.tradefed.log;
18 
19 import com.android.tradefed.result.InputStreamSource;
20 import com.android.tradefed.result.LogDataType;
21 
22 /**
23  * An entity that can perform logging of data streams of various types.
24  */
25 public interface ITestLogger {
26 
27     /**
28      * Provides the associated log or debug data from the test invocation.
29      * <p/>
30      * Must be called before {@link ITestInvocationListener#invocationFailed(Throwable)} or
31      * {@link ITestInvocationListener#invocationEnded(long)}
32      * <p/>
33      * The TradeFederation framework will automatically call this method, providing the host log
34      * and if applicable, the device logcat.
35      *
36      * @param dataName a {@link String} descriptive name of the data. e.g. "device_logcat". Note
37      *            dataName may not be unique per invocation. ie implementers must be able to handle
38      *            multiple calls with same dataName
39      * @param dataType the {@link LogDataType} of the data
40      * @param dataStream the {@link InputStreamSource} of the data. Implementers should call
41      *        createInputStream to start reading the data, and ensure to close the resulting
42      *        InputStream when complete. Callers should ensure the source of the data remains
43      *        present and accessible until the testLog method completes.
44      */
testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)45     default public void testLog(String dataName, LogDataType dataType,
46             InputStreamSource dataStream) { }
47 
48 }
49