public class FormattedLog extends AbstractLog
Log implementation that applies a simple formatting to each log message.| Modifier and Type | Class and Description |
|---|---|
static class |
FormattedLog.Builder
A Builder for a
FormattedLog |
| Modifier and Type | Method and Description |
|---|---|
void |
bulk(Consumer<Log> consumer)
Used to temporarily log several messages in bulk.
|
Logger |
debugLogger() |
Logger |
errorLogger() |
Level |
getLevel()
Get the current
Level that logging is enabled at |
Logger |
infoLogger() |
boolean |
isDebugEnabled() |
boolean |
isErrorEnabled() |
boolean |
isInfoEnabled() |
boolean |
isWarnEnabled() |
Level |
setLevel(Level level)
Set the
Level that logging should be enabled at |
static FormattedLog |
toOutputStream(OutputStream out)
Creates a
FormattedLog instance that writes messages to an OutputStream. |
static FormattedLog |
toOutputStream(Supplier<OutputStream> outSupplier)
Creates a
FormattedLog instance that writes messages to OutputStreams obtained from the specified
Supplier. |
static FormattedLog |
toPrintWriter(PrintWriter writer)
Creates a
FormattedLog instance that writes messages to a PrintWriter. |
static FormattedLog |
toPrintWriter(Supplier<PrintWriter> writerSupplier)
Creates a
FormattedLog instance that writes messages to PrintWriters obtained from the specified
Supplier. |
static FormattedLog |
toWriter(Writer writer)
Creates a
FormattedLog instance that writes messages to a Writer. |
static FormattedLog.Builder |
usingLock(Object lock)
Start creating a
FormattedLog using the specified object to synchronize on. |
Logger |
warnLogger() |
static FormattedLog.Builder |
withCategory(String category)
Include the specified category in each output log line
|
static FormattedLog.Builder |
withLogLevel(Level level)
Start creating a
FormattedLog with the specified log Level as a default. |
static FormattedLog.Builder |
withoutAutoFlush()
Start creating a
FormattedLog without auto flushing. |
static FormattedLog.Builder |
withTimeZone(TimeZone timezone)
Start creating a
FormattedLog with the specified timezone for datestamps in the log |
static FormattedLog.Builder |
withUTCTimeZone()
Start creating a
FormattedLog with UTC timezone for datestamps in the log |
public static FormattedLog.Builder withUTCTimeZone()
FormattedLog with UTC timezone for datestamps in the logFormattedLogpublic static FormattedLog.Builder withTimeZone(TimeZone timezone)
FormattedLog with the specified timezone for datestamps in the logtimezone - the timezone to use for datestampsFormattedLogpublic static FormattedLog.Builder usingLock(Object lock)
FormattedLog using the specified object to synchronize on.
Use FormattedLog.Builder.toOutputStream(java.io.OutputStream) to complete.lock - the object to synchronize onFormattedLogpublic static FormattedLog.Builder withCategory(String category)
category - the category to include ing each output lineFormattedLogpublic static FormattedLog.Builder withLogLevel(Level level)
FormattedLog with the specified log Level as a default.
Use FormattedLog.Builder.toOutputStream(java.io.OutputStream) to complete.level - the log level to use as a defaultFormattedLogpublic static FormattedLog.Builder withoutAutoFlush()
FormattedLog without auto flushing.
Use FormattedLog.Builder.toOutputStream(java.io.OutputStream) to complete.FormattedLogpublic static FormattedLog toOutputStream(OutputStream out)
FormattedLog instance that writes messages to an OutputStream.out - An OutputStream to write toFormattedLog instance that writes to the specified OutputStreampublic static FormattedLog toOutputStream(Supplier<OutputStream> outSupplier)
FormattedLog instance that writes messages to OutputStreams obtained from the specified
Supplier. The OutputStream is obtained from the Supplier before every log message is written.outSupplier - A supplier for an output stream to write toFormattedLog instancepublic static FormattedLog toWriter(Writer writer)
FormattedLog instance that writes messages to a Writer.writer - A Writer to write toFormattedLog instance that writes to the specified Writerpublic static FormattedLog toPrintWriter(PrintWriter writer)
FormattedLog instance that writes messages to a PrintWriter.writer - A PrintWriter to write toFormattedLog instance that writes to the specified PrintWriterpublic static FormattedLog toPrintWriter(Supplier<PrintWriter> writerSupplier)
FormattedLog instance that writes messages to PrintWriters obtained from the specified
Supplier. The PrintWriter is obtained from the Supplier before every log message is written.writerSupplier - A supplier for a PrintWriter to write toFormattedLog instance that writes to the specified PrintWriterpublic Level getLevel()
Level that logging is enabled atpublic Level setLevel(Level level)
Level that logging should be enabled atlevel - the new logging levelpublic boolean isDebugEnabled()
@Nonnull public Logger debugLogger()
Logger instance for writing debug messagespublic boolean isInfoEnabled()
public boolean isWarnEnabled()
public boolean isErrorEnabled()
@Nonnull public Logger errorLogger()
Logger instance for writing error messagespublic void bulk(@Nonnull Consumer<Log> consumer)
Logconsumer - A consumer for the bulk LogCopyright © 2002–2016 The Neo4j Graph Database Project. All rights reserved.