Source Code for SLF4J 1.7.31 Simple Logging

SLF4J Simple Logging is a simple logging library that implements the SLF4J API.

Here is the source code for SLF4J Simple Logging 1.7.31. You can download its pre-compiled version slf4j-simple-1.7.31.jar at SLF4J Download Website.

✍: FYIcenter.com

org/slf4j/impl/OutputChoice.java

package org.slf4j.impl;

import java.io.PrintStream;

/**
 * This class encapsulates the user's choice of output target.
 * 
 * @author Ceki Gülcü
 *
 */
class OutputChoice {

    enum OutputChoiceType {
        SYS_OUT, CACHED_SYS_OUT, SYS_ERR, CACHED_SYS_ERR, FILE;
    }

    final OutputChoiceType outputChoiceType;
    final PrintStream targetPrintStream;

    OutputChoice(OutputChoiceType outputChoiceType) {
        if (outputChoiceType == OutputChoiceType.FILE) {
            throw new IllegalArgumentException();
        }
        this.outputChoiceType = outputChoiceType;
        if (outputChoiceType == OutputChoiceType.CACHED_SYS_OUT) {
            this.targetPrintStream = System.out;
        } else if (outputChoiceType == OutputChoiceType.CACHED_SYS_ERR) {
            this.targetPrintStream = System.err;
        } else {
            this.targetPrintStream = null;
        }
    }

    OutputChoice(PrintStream printStream) {
        this.outputChoiceType = OutputChoiceType.FILE;
        this.targetPrintStream = printStream;
    }

    PrintStream getTargetPrintStream() {
        switch (outputChoiceType) {
        case SYS_OUT:
            return System.out;
        case SYS_ERR:
            return System.err;
        case CACHED_SYS_ERR:
        case CACHED_SYS_OUT:
        case FILE:
            return targetPrintStream;
        default:
            throw new IllegalArgumentException();
        }

    }

}

org/slf4j/impl/OutputChoice.java

 

Or download all of them as a single archive file:

File name: slf4j-simple-1.7.31-sources.jar
File size: 15201 bytes
Release date: 2021-06-17
Download 

 

Source Code for SLF4J 1.7.31 Bridge to JDK

SLF4J 1.7.31 API Source Code

Downloading and Reviewing SLF4J Packages

⇑⇑ SLF4J - Simple Logging Facade for Java

2023-03-07, 1668👍, 0💬