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