Class Slf4jStream
- java.lang.Object
-
- org.zeroturnaround.exec.stream.slf4j.Slf4jStream
-
public class Slf4jStream extends java.lang.ObjectCreates output streams that write toLoggers.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.Loggerlog
-
Constructor Summary
Constructors Modifier Constructor Description privateSlf4jStream(org.slf4j.Logger log)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Slf4jOutputStreamas(Level level)Slf4jOutputStreamasDebug()Slf4jOutputStreamasError()Slf4jOutputStreamasInfo()Slf4jOutputStreamasTrace()Slf4jOutputStreamasWarn()static Slf4jStreamof(java.lang.Class<?> klass)static Slf4jStreamof(java.lang.Class<?> klass, java.lang.String name)Constructs a logger from a class name and an additional name, appended to the end.static Slf4jStreamof(java.lang.String name)static Slf4jStreamof(org.slf4j.Logger log)static Slf4jStreamofCaller()
-
-
-
Method Detail
-
of
public static Slf4jStream of(org.slf4j.Logger log)
- Parameters:
log- logger which an output stream redirects to.- Returns:
- Slf4jStream with the given logger.
-
of
public static Slf4jStream of(java.lang.Class<?> klass)
- Parameters:
klass- class which is used to get the logger's name.- Returns:
- Slf4jStream with a logger named after the given class.
-
of
public static Slf4jStream of(java.lang.Class<?> klass, java.lang.String name)
Constructs a logger from a class name and an additional name, appended to the end. So the final logger name will be:klass.getName() + "." + name- Parameters:
klass- class which is used to get the logger's name.name- logger's name, appended to the class name.- Returns:
- Slf4jStream with a logger named after the given class.
- Since:
- 1.8
-
of
public static Slf4jStream of(java.lang.String name)
- Parameters:
name- logger's name (full or short). In case of short name (no dots) the given name is prefixed by caller's class name and a dot.- Returns:
- Slf4jStream with the given logger.
-
ofCaller
public static Slf4jStream ofCaller()
- Returns:
- Slf4jStream with the logger of caller of this method.
-
as
public Slf4jOutputStream as(Level level)
- Parameters:
level- the desired logging level- Returns:
- output stream that writes with a given level.
-
asTrace
public Slf4jOutputStream asTrace()
- Returns:
- output stream that writes
tracelevel.
-
asDebug
public Slf4jOutputStream asDebug()
- Returns:
- output stream that writes
debuglevel.
-
asInfo
public Slf4jOutputStream asInfo()
- Returns:
- output stream that writes
infolevel.
-
asWarn
public Slf4jOutputStream asWarn()
- Returns:
- output stream that writes
warnlevel.
-
asError
public Slf4jOutputStream asError()
- Returns:
- output stream that writes
errorlevel.
-
-