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.spi.ContextAware;
018
019
020/**
021 * <p>Allows programmatic initialization and configuration of Logback. The
022 * ServiceLoader is typically used to instantiate implementations and thus
023 * implementations will need to follow the guidelines of the ServiceLoader,
024 * in particular the no-arg constructor requirement.</p>
025 *
026 * <p>The return type of {@link #configure(LoggerContext)  configure} was changed from 'void' to
027 * {@link ExecutionStatus} in logback version 1.3.0.
028 * </p>
029 */
030public interface Configurator extends ContextAware {
031
032    enum ExecutionStatus {
033        NEUTRAL, // let the caller decide
034        INVOKE_NEXT_IF_ANY, // invoke other
035        DO_NOT_INVOKE_NEXT_IF_ANY // the caller should not invoke further configurators even some are available
036    }
037
038    /**
039     * Implementations of this method may expect that the {@link LoggerContext} is set with
040     * {@link ContextAware#setContext} before this method is invoked.
041     *
042     */
043    ExecutionStatus configure(LoggerContext context);
044
045}