Loggable.java revision 953:221a84ef44c0
155714Skris/* 259191Skris * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. 355714Skris * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 455714Skris * 555714Skris * This code is free software; you can redistribute it and/or modify it 655714Skris * under the terms of the GNU General Public License version 2 only, as 755714Skris * published by the Free Software Foundation. Oracle designates this 855714Skris * particular file as subject to the "Classpath" exception as provided 955714Skris * by Oracle in the LICENSE file that accompanied this code. 1055714Skris * 1155714Skris * This code is distributed in the hope that it will be useful, but WITHOUT 1255714Skris * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1355714Skris * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1455714Skris * version 2 for more details (a copy is included in the LICENSE file that 1555714Skris * accompanied this code). 1655714Skris * 1755714Skris * You should have received a copy of the GNU General Public License version 1855714Skris * 2 along with this work; if not, write to the Free Software Foundation, 1955714Skris * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2055714Skris * 2155714Skris * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2255714Skris * or visit www.oracle.com if you need additional information or have any 2355714Skris * questions. 2455714Skris */ 2555714Skrispackage jdk.nashorn.internal.runtime.logging; 2655714Skris 2755714Skrisimport jdk.nashorn.internal.runtime.Context; 2855714Skris 2955714Skris/** 3055714Skris * Interface implemented by classes that are loggable. 3155714Skris * Their instances will provide functionality for initializing 3255714Skris * a logger (usually by asking Global for it, with a reference 3355714Skris * to this.getClass()) and a method to return the logger in 3455714Skris * use 3555714Skris * 3655714Skris * Typically a class implementing this interface also has the 3755714Skris * Logger annotation 3855714Skris * 3955714Skris * @see Logger 4055714Skris */ 4155714Skrispublic interface Loggable { 4255714Skris /** 4355714Skris * Initialize a logger, by asking Context to get or create it 4455714Skris * and then keep it in a table by name 4555714Skris * 4655714Skris * @param context context 4755714Skris * @return the initialized logger 4855714Skris */ 4955714Skris public DebugLogger initLogger(final Context context); 5055714Skris 5155714Skris /** 5255714Skris * Return the logger in use 5355714Skris * @return logger 5455714Skris */ 5555714Skris public DebugLogger getLogger(); 5655714Skris} 5755714Skris