15977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot/*
25977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot * Copyright (C) 2010 The Android Open Source Project
35977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot *
45977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot * Licensed under the Apache License, Version 2.0 (the "License");
55977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot * you may not use this file except in compliance with the License.
65977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot * You may obtain a copy of the License at
75977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot *
85977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot *      http://www.apache.org/licenses/LICENSE-2.0
95977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot *
105977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot * Unless required by applicable law or agreed to in writing, software
115977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot * distributed under the License is distributed on an "AS IS" BASIS,
125977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot * See the License for the specific language governing permissions and
145977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot * limitations under the License.
155977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot */
165977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
175977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabotpackage vogar.util;
185977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
195977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabotimport java.util.List;
205977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
215977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabotpublic class Log {
225977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
235977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    private static LogOutput sLogoutput = null;
245977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
255977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    public static void setOutput(LogOutput logOutput) {
265977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        sLogoutput = logOutput;
275977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    }
285977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
295977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    public static void verbose(String s) {
305977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        if (sLogoutput != null) {
315977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot            sLogoutput.verbose(s);
325977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        }
335977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    }
345977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
355977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    public static void warn(String message) {
365977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        if (sLogoutput != null) {
375977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot            sLogoutput.warn(message);
385977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        }
395977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    }
405977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
415977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    /**
425977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot     * Warns, and also puts a list of strings afterwards.
435977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot     */
445977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    public static void warn(String message, List<String> list) {
455977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        if (sLogoutput != null) {
465977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot            sLogoutput.warn(message, list);
475977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        }
485977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    }
495977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
505977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    public static void info(String s) {
515977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        if (sLogoutput != null) {
525977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot            sLogoutput.info(s);
535977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        }
545977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    }
555977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
565977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    public static void info(String message, Throwable throwable) {
575977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        if (sLogoutput != null) {
585977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot            sLogoutput.info(message, throwable);
595977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        }
605977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    }
615977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
625977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    public static void nativeOutput(String outputLine) {
635977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        if (sLogoutput != null) {
645977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot            sLogoutput.nativeOutput(outputLine);
655977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot        }
665977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot
675977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot    }
685977e94bfe57100042cdf41e476d7cb971137e5fBrett Chabot}
69