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 package com.example.android.common.logger; 17 18 /** 19 * Basic interface for a logging system that can output to one or more targets. 20 * Note that in addition to classes that will output these logs in some format, 21 * one can also implement this interface over a filter and insert that in the chain, 22 * such that no targets further down see certain data, or see manipulated forms of the data. 23 * You could, for instance, write a "ToHtmlLoggerNode" that just converted all the log data 24 * it received to HTML and sent it along to the next node in the chain, without printing it 25 * anywhere. 26 */ 27 public interface LogNode { 28 29 /** 30 * Instructs first LogNode in the list to print the log data provided. 31 * 32 * @param priority Log level of the data being logged. Verbose, Error, etc. 33 * @param tag Tag for for the log data. Can be used to organize log statements. 34 * @param msg The actual message to be logged. The actual message to be logged. 35 * @param tr If an exception was thrown, this can be sent along for the logging 36 * facilities 37 * to extract and print useful information. 38 */ println(int priority, String tag, String msg, Throwable tr)39 public void println(int priority, String tag, String msg, Throwable tr); 40 41 } 42