Package org.stianloader.picoresolve.logging

# Class LoggingAdapter

java.lang.Object
org.stianloader.picoresolve.logging.LoggingAdapter

public abstract class LoggingAdapter extends Object
There comes a time where any library must log something. Be it for debug purposes, error handling or simple warnings for things that were dealt with in a sub-standard fashion.

Ordinarily we'd use SLF4J and call it a day. However, as picoresolve is developed to have the fewest dependencies possible, picoresolve will abstract away the logging into the `LoggingAdapter` interface, allowing logging to function even when SLF4J is not present on the classpath. The default implementation uses SLF4J as the log sink if it exists, otherwise it will fall back to using JUL as the logger, as defined by `Logger`.

This facade should support "standard" SLF4J placeholders via "{}". Not all arguments may map to a placeholder and in case they do not then they should simply be appended to the end of the message. Leftover "{}" placeholders need to be kept as-is. Implementations of this interface are free to assume that "{}" never need to be escaped and that likewise no indexing occurs (e.g. that "{2}" should never happen). If the last argument is a `Throwable`, it's stacktrace should be logged.

## Constructor Summary

Constructors
Constructor
Description
`LoggingAdapter()`

## Method Summary

Modifier and Type
Method
Description
`abstract void`
`debug(Class<?> clazz, String message, Object... args)`
`abstract void`
`error(Class<?> clazz, String message, Object... args)`
`static @NotNull LoggingAdapter`
`getDefaultLogger()`
`abstract void`
`info(Class<?> clazz, String message, Object... args)`
`static void`
`setDefaultLogger(@NotNull LoggingAdapter instance)`
`abstract void`
`warn(Class<?> clazz, String message, Object... args)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LoggingAdapter

public LoggingAdapter()

## Method Details

### getDefaultLogger

@NotNull public static @NotNull LoggingAdapter getDefaultLogger()

### setDefaultLogger

public static void setDefaultLogger(@NotNull @NotNull LoggingAdapter instance)

### debug

public abstract void debug(Class<?> clazz, String message, Object... args)

### error

public abstract void error(Class<?> clazz, String message, Object... args)

### info

public abstract void info(Class<?> clazz, String message, Object... args)

### warn

public abstract void warn(Class<?> clazz, String message, Object... args)