JavaLoggingInfoStream (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.util, class: JavaLoggingInfoStream

Package org.apache.lucene.util

# Class JavaLoggingInfoStream

java.lang.Object
org.apache.lucene.util.InfoStream
org.apache.lucene.util.JavaLoggingInfoStream

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public final class JavaLoggingInfoStream extends InfoStream
InfoStream implementation that logs every message using Java Utils Logging (JUL) with the supplied log level.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.util.InfoStream

  `NO_OUTPUT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JavaLoggingInfoStream(String namePrefix, Level level)`
  Gets an implementation that logs using the given log level and adds a prefix to the component name.
  `JavaLoggingInfoStream(Function<String,String> componentToLoggerName, Level level)`
  Gets an implementation that logs using the given log level with a logger name derived from the component name.
  `JavaLoggingInfoStream(Level level)`
  Gets an implementation using the given log level with a default prefix `"org.apache.lucene."`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `boolean`
  `isEnabled(String component)`
  returns true if messages are enabled and should be posted to `InfoStream.message(java.lang.String, java.lang.String)`.
  `void`
  `message(String component, String message)`
  prints a message

  ### Methods inherited from class org.apache.lucene.util.InfoStream

  `getDefault, setDefault`

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

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

- ## Constructor Details

  - ### JavaLoggingInfoStream

    public JavaLoggingInfoStream(Level level)
    Gets an implementation using the given log level with a default prefix `"org.apache.lucene."`.
    Parameters:
      `level` - Requested log level to be used while logging

  - ### JavaLoggingInfoStream

    public JavaLoggingInfoStream(String namePrefix, Level level)
    Gets an implementation that logs using the given log level and adds a prefix to the component name.
    Parameters:
      `namePrefix` - Prefix to be applied to all component names. It must be empty or include a final dot
      `level` - Requested log level to be used while logging

  - ### JavaLoggingInfoStream

    public JavaLoggingInfoStream(Function<String,String> componentToLoggerName, Level level)
    Gets an implementation that logs using the given log level with a logger name derived from the component name.
    Parameters:
      `componentToLoggerName` - A function to convert a component name to a valid JUL logger name
      `level` - Requested log level to be used while logging

- ## Method Details

  - ### message

    public void message(String component, String message)
    Description copied from class: `InfoStream`
    prints a message
    Specified by:
      `message` in class `InfoStream`

  - ### isEnabled

    public boolean isEnabled(String component)
    Description copied from class: `InfoStream`
    returns true if messages are enabled and should be posted to `InfoStream.message(java.lang.String, java.lang.String)`.
    Specified by:
      `isEnabled` in class `InfoStream`

  - ### close

    public void close()