Class LogFileConfiguration


  • public final class LogFileConfiguration
    extends Object
    A class that describes the file configuration for the FileLogger class. These options must be set atomically so they won't take effect unless a new configuration object is set on the logger. Attempting to modify an in-use configuration object will result in an exception being thrown.
    • Constructor Detail

      • LogFileConfiguration

        public LogFileConfiguration​(@NonNull
                                    String directory)
        Constructs a file configuration object with the given directory
        Parameters:
        directory - The directory that the logs will be written to
      • LogFileConfiguration

        public LogFileConfiguration​(@NonNull
                                    LogFileConfiguration config)
        Constructs a file configuration object based on another one so that it may be modified
        Parameters:
        config - The other configuration to copy settings from
      • LogFileConfiguration

        public LogFileConfiguration​(@NonNull
                                    String directory,
                                    @Nullable
                                    LogFileConfiguration config)
        Constructs a file configuration object based on another one but changing the directory
        Parameters:
        directory - The directory that the logs will be written to
        config - The other configuration to copy settings from
    • Method Detail

      • setUsePlaintext

        @NonNull
        public LogFileConfiguration setUsePlaintext​(boolean usePlaintext)
        Sets whether or not to log in plaintext. The default is to log in a binary encoded format that is more CPU and I/O friendly and enabling plaintext is not recommended in production.
        Parameters:
        usePlaintext - Whether or not to log in plaintext
        Returns:
        The self object
      • getMaxRotateCount

        public int getMaxRotateCount()
        Gets the number of rotated logs that are saved (i.e. if the value is 1, then 2 logs will be present: the 'current' and the 'rotated')
        Returns:
        The number of rotated logs that are saved
      • setMaxRotateCount

        @NonNull
        public LogFileConfiguration setMaxRotateCount​(int maxRotateCount)
        Sets the number of rotated logs that are saved (i.e. if the value is 1, then 2 logs will be present: the 'current' and the 'rotated')
        Parameters:
        maxRotateCount - The number of rotated logs to be saved
        Returns:
        The self object
      • getMaxSize

        public long getMaxSize()
        Gets the max size of the log file in bytes. If a log file passes this size then a new log file will be started. This number is a best effort and the actual size may go over slightly.
        Returns:
        The max size of the log file in bytes
      • setMaxSize

        @NonNull
        public LogFileConfiguration setMaxSize​(long maxSize)
        Sets the max size of the log file in bytes. If a log file passes this size then a new log file will be started. This number is a best effort and the actual size may go over slightly.
        Parameters:
        maxSize - The max size of the log file in bytes
        Returns:
        The self object
      • usesPlaintext

        public boolean usesPlaintext()
        Gets whether or not CBL is logging in plaintext. The default is to log in a binary encoded format that is more CPU and I/O friendly and enabling plaintext is not recommended in production.
        Returns:
        Whether or not CBL is logging in plaintext
      • getDirectory

        @NonNull
        public String getDirectory()
        Gets the directory that the logs files are stored in.
        Returns:
        The directory that the logs files are stored in.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object