001/*
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2023, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.classic.spi;
015
016import ch.qos.logback.classic.LoggerContext;
017import ch.qos.logback.core.Context;
018import ch.qos.logback.core.spi.ContextAware;
019
020import java.lang.annotation.ElementType;
021import java.lang.annotation.Retention;
022import java.lang.annotation.RetentionPolicy;
023import java.lang.annotation.Target;
024
025/**
026 * Allows programmatic initialization and configuration of Logback. The
027 * ServiceLoader is typically used to instantiate implementations and thus
028 * implementations will need to follow the guidelines of the ServiceLoader,
029 * in particular the no-arg constructor requirement.
030 *
031 * The return type of {@link #configure(LoggerContext)  configure} was changed from 'void' to
032 * {@link ExecutionStatus) in logback version 1.3.0.
033 */
034public interface Configurator extends ContextAware {
035
036    enum ExecutionStatus {
037        NEUTRAL, // let the caller decide
038        INVOKE_NEXT_IF_ANY, // invoke other
039        DO_NOT_INVOKE_NEXT_IF_ANY // the caller should not invoke further configurators even some are available
040    }
041
042    /**
043     * Implementations of this method may expect that the {@link LoggerContext} is set with
044     * {@link ContextAware#setContext} before this method is invoked.
045     *
046     */
047    ExecutionStatus configure(LoggerContext context);
048
049}