pub struct Config { /* private fields */ }Expand description
Configuration of a logger instance.
Implementations§
Source§impl Config
impl Config
Sourcepub fn use_mmap(self, flag: bool) -> Self
pub fn use_mmap(self, flag: bool) -> Self
Whether or not to use mmap as the underlying storage for the buffer.
With mmap, if the application terminates unexpectedly, the log data in the buffer is written to the mmap buffer file by the OS at a certain time, and then when the logger is restarted, the log data is written back to the log file, avoiding loss of log data.
It is enabled by default.
Sourcepub fn buffer_len(self, len: usize) -> Self
pub fn buffer_len(self, len: usize) -> Self
The buffer length.
If mmap is used, it is rounded up to a multiple of pagesize. Pinenut uses a double cache system, so the buffer that is actually written to will be less than half of this.
The default value is 320 KB.
Sourcepub fn rotation(self, rotation: TimeDimension) -> Self
pub fn rotation(self, rotation: TimeDimension) -> Self
Time granularity of log extraction.
The default value is Minute.
Sourcepub fn key(self, key: Option<PublicKey>) -> Self
pub fn key(self, key: Option<PublicKey>) -> Self
The encryption key, the public key in ECDH.
It is used to negotiate the key for symmetric encryption of the log.
If the value is None, there is no encryption.
The default value is None.
Sourcepub fn key_str(self, key: Option<impl AsRef<[u8]>>) -> Self
pub fn key_str(self, key: Option<impl AsRef<[u8]>>) -> Self
The encryption key, the public key in ECDH, represented in Base64.
It is used to negotiate the key for symmetric encryption of the log.
If the value is None or invalid, there is no encryption.
The default value is None.
Sourcepub fn compression_level(self, level: i32) -> Self
pub fn compression_level(self, level: i32) -> Self
The compression level.
Pinenut uses zstd as the compression algorithm, which supports compression
levels from 1 up to 22, it also offers negative compression levels.
As the std’s documentation says: The lower the level, the faster the
speed (at the cost of compression).
The default value is 10.