Copyright © 2015-2016 Takeru Ohta <phjgt308@gmail.com>
This module defines the logi_sink_file_rotator behaviour.
Required callback functions: rotate/2, get_current_filepath/2, is_outdated/2.
callback_module() = module()
A module that implements the logi_sink_file_rotator
behaviour.
abstract datatype: rotator()
A rotator instance
state() = term()
The state of an instance of a logi_sink_file_rotator
implementing module.
get_current_filepath/2 | Gets the current output file path. |
is_outdated/2 | Determines the given file path is outdated. |
is_rotator/1 | Returns true if X is a rotator instance, false otherwise. |
new/1 | Equivalent to new(Module, undefined). |
new/2 | Creates a new rotator instance. |
rotate/2 | Rotates Filepath |
get_current_filepath(BaseFilePath::logi_sink_file:filepath(), X2::rotator()) -> {ok, logi_sink_file:filepath(), rotator()} | {error, Reason::term()}
Gets the current output file path
is_outdated(FilePath::logi_sink_file:filepath(), X2::rotator()) -> {IsOutdated::boolean(), NextCheckTime::timeout(), rotator()}
Determines the given file path is outdated
If IsOutdated
is false
, the caller process invokes rotate/2
to rotate the old file.
Then it will reopen a new file path which is the result of get_current_filepath/2
.
NextCheckTime
milliseconds.
is_rotator(X::rotator() | term()) -> boolean()
Returns true
if X
is a rotator instance, false
otherwise
new(Module::callback_module()) -> rotator()
Equivalent to new(Module, undefined).
new(Module::callback_module(), State::state()) -> rotator()
Creates a new rotator instance
rotate(FilePath::logi_sink_file:filepath(), X2::rotator()) -> {ok, Rotated::logi_sink_file:filepath(), rotator()} | {error, Reason::term()}
Rotates Filepath
Rotated
is new file path after the rotation.
It may be the same as FilePath
.
Generated by EDoc, Sep 27 2018, 23:13:24.