private FormattedLog buildLog( String context, Level level ) { return new FormattedLog( writerSupplier, zoneId, this, renderContext ? context : null, level, autoFlush ); }
/** * Creates a {@link FormattedLog} instance that writes messages to {@link PrintWriter}s obtained from the specified * {@link Supplier}. The PrintWriter is obtained from the Supplier before every log message is written. * * @param writerSupplier A supplier for a {@link PrintWriter} to write to * @return A {@link FormattedLog} instance that writes to the specified PrintWriter */ public FormattedLog toPrintWriter( Supplier<PrintWriter> writerSupplier ) { return new FormattedLog( writerSupplier, zoneId, lock, category, level, autoFlush, dateTimeFormatter, dateTimeFormatterSupplier ); } }
@Override public void bulk( @Nonnull Consumer<Log> consumer ) { PrintWriter writer; synchronized ( lock ) { writer = writerSupplier.get(); consumer.accept( new FormattedLog( Suppliers.singleton( writer ), zoneId, lock, category, levelRef.get(), false ) ); } if ( autoFlush ) { writer.flush(); } }
private FormattedLog buildLog( String context, Level level ) { return new FormattedLog( writerSupplier, zoneId, this, renderContext ? context : null, level, autoFlush ); }
/** * Creates a {@link FormattedLog} instance that writes messages to {@link PrintWriter}s obtained from the specified * {@link Supplier}. The PrintWriter is obtained from the Supplier before every log message is written. * * @param writerSupplier A supplier for a {@link PrintWriter} to write to * @return A {@link FormattedLog} instance that writes to the specified PrintWriter */ public FormattedLog toPrintWriter( Supplier<PrintWriter> writerSupplier ) { return new FormattedLog( writerSupplier, zoneId, lock, category, level, autoFlush, dateTimeFormatter, dateTimeFormatterSupplier ); } }
@Override public void bulk( @Nonnull Consumer<Log> consumer ) { PrintWriter writer; synchronized ( lock ) { writer = writerSupplier.get(); consumer.accept( new FormattedLog( Suppliers.singleton( writer ), zoneId, lock, category, levelRef.get(), false ) ); } if ( autoFlush ) { writer.flush(); } }