Package com.couchbase.lite
Class LogFileConfiguration
java.lang.Object
com.couchbase.lite.LogFileConfiguration
A class that describes the file configuration for the
FileLogger
class.
Once a configuration has been assigned to a Logger, it becomes read-only:
an attempt to mutate it will cause an exception.
To change the configuration of a logger, copy its configuration, mutate the
copy and then use it to replace the loggers current configuration.-
Constructor Summary
ConstructorDescriptionConstructs a file configuration object based on another one so that it may be modifiedLogFileConfiguration
(String directory) Constructs a file configuration object with the given directoryLogFileConfiguration
(String directory, LogFileConfiguration config) Constructs a file configuration object based on another one but changing the directory -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the directory that the logs files are stored in.int
Gets the number of rotated logs that are saved.long
Gets the max size of the log file in bytes.int
hashCode()
setMaxRotateCount
(int maxRotateCount) Sets the number of rotated logs that are saved.setMaxSize
(long maxSize) Sets the max size of the log file in bytes.setUsePlaintext
(boolean usePlaintext) Sets whether or not CBL logs in plaintext.boolean
Gets whether or not CBL is logging in plaintext.
-
Constructor Details
-
LogFileConfiguration
Constructs a file configuration object with the given directory- Parameters:
directory
- The directory that the logs will be written to
-
LogFileConfiguration
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
Constructs a file configuration object based on another one but changing the directory- Parameters:
directory
- The directory that the logs will be written toconfig
- The other configuration to copy settings from
-
-
Method Details
-
setMaxSize
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. The default size is 500Kb.- Parameters:
maxSize
- The max size of the log file in bytes- Returns:
- The self object
-
setMaxRotateCount
Sets the number of rotated logs that are saved. For instance, if the value is 1 then 2 logs will be present: the 'current' log and the previous 'rotated' log. The default value is 1.- Parameters:
maxRotateCount
- The number of rotated logs to be saved- Returns:
- The self object
-
setUsePlaintext
Sets whether or not CBL logs in plaintext. The default (false) is to log in a binary encoded format that is more CPU and I/O friendly. Enabling plaintext is not recommended in production.- Parameters:
usePlaintext
- Whether or not to log in plaintext- Returns:
- The self object
-
getDirectory
Gets the directory that the logs files are stored in.- Returns:
- The directory that the logs files are stored in.
-
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. The default size is 500Kb.- Returns:
- The max size of the log file in bytes
-
getMaxRotateCount
public int getMaxRotateCount()Gets the number of rotated logs that are saved. For instance, if the value is 1 then 2 logs will be present: the 'current' log and the previous 'rotated' log. The default value is 1.- Returns:
- The number of rotated logs that are saved
-
usesPlaintext
public boolean usesPlaintext()Gets whether or not CBL is logging in plaintext. The default (false) is to log in a binary encoded format that is more CPU and I/O friendly. Enabling plaintext is not recommended in production.- Returns:
- Whether or not CBL is logging in plaintext
-
equals
-
hashCode
public int hashCode()
-