Class FileOutputBuilder

java.lang.Object
io.jstach.rainbowgum.output.FileOutputBuilder
All Implemented Interfaces:
LogBuilder<FileOutputBuilder,FileOutput>

public final class FileOutputBuilder extends Object implements LogBuilder<FileOutputBuilder,FileOutput>
Builder to create FileOutput. Creates file output.
Properties retrieved from LogProperties
Property Pattern Type Required Default Description
"logging.output.{name}.uri" URI false null File uri.
"logging.output.{name}.fileName" String false null File name.
"logging.output.{name}.append" Boolean false null Whether or not to append to existing file.
"logging.output.{name}.prudent" Boolean false null Logback prudent mode where files are locked on each write.
"logging.output.{name}.bufferSize" Integer true 8192 Buffer size in bytes.
  • Constructor Details

    • FileOutputBuilder

      public FileOutputBuilder(String name)
      Create a builder for io.jstach.rainbowgum.output.FileOutput .
      Parameters:
      name - will fill {name} in logging.output.{name}.. Name of output not file name.
  • Method Details

    • uri

      public FileOutputBuilder uri(@Nullable URI uri)
      Sets uri. File uri. Default is null.
      Parameters:
      uri - "logging.output.{name}.uri" = java.net.URI File uri.
      Returns:
      this builder.
    • fileName

      public FileOutputBuilder fileName(@Nullable String fileName)
      Sets fileName. File name. Default is null.
      Parameters:
      fileName - "logging.output.{name}.fileName" = java.lang.String File name.
      Returns:
      this builder.
    • append

      public FileOutputBuilder append(@Nullable Boolean append)
      Sets append. Whether or not to append to existing file. Default is null.
      Parameters:
      append - "logging.output.{name}.append" = java.lang.Boolean Whether or not to append to existing file.
      Returns:
      this builder.
    • prudent

      public FileOutputBuilder prudent(@Nullable Boolean prudent)
      Sets prudent. Logback prudent mode where files are locked on each write. Default is null.
      Parameters:
      prudent - "logging.output.{name}.prudent" = java.lang.Boolean Logback prudent mode where files are locked on each write.
      Returns:
      this builder.
    • bufferSize

      public FileOutputBuilder bufferSize(Integer bufferSize)
      Sets required bufferSize. Buffer size in bytes. Default is 8192.
      Parameters:
      bufferSize - "logging.output.{name}.bufferSize" = java.lang.Integer Buffer size in bytes.
      Returns:
      this builder.
    • build

      Creates io.jstach.rainbowgum.output.FileOutput from this builder.
      Returns:
      io.jstach.rainbowgum.output.FileOutput .
      Throws:
      UncheckedIOException - if factory method fails.
    • fromProperties

      Description copied from interface: LogBuilder
      Will try to convert string key values to parameters needed by the builder.
      Specified by:
      fromProperties in interface LogBuilder<FileOutputBuilder,FileOutput>
      Parameters:
      properties - log properties
      Returns:
      this.
    • toProperties

      public void toProperties(BiConsumer<String,String> consumer)
      Turns the builder into java.util.Properties like Map skipping values that are null.
      Parameters:
      consumer - apply is called where first arg is key and second is value.
    • propertyPrefix

      The interpolated property prefix: "logging.output.{name}.".
      Specified by:
      propertyPrefix in interface LogBuilder<FileOutputBuilder,FileOutput>
      Returns:
      resolved prefix which should end with a ".".
      See Also: