Module lager_file_backend

File backend for lager, with multiple file support.

Behaviours: gen_event.


File backend for lager, with multiple file support. Multiple files are supported, each with the path and the loglevel being configurable. The configuration paramter for this backend is a list of key-value 2-tuples. See the init() function for the available options. This backend supports external and internal log rotation and will re-open handles to files if the inode changes. It will also rotate the files itself if the size of the file exceeds the size and keep count rotated files. date is an alternate rotation trigger, based on time. See the README for documentation. For performance, the file backend does delayed writes, although it will sync at specific log levels, configured via the sync_on option. By default the error level or above will trigger a sync.

Data Types


option() = {file, string()} | {level, lager:log_level()} | {size, non_neg_integer()} | {date, string()} | {count, non_neg_integer()} | {rotator, atom()} | {high_water_mark, non_neg_integer()} | {flush_queue, boolean()} | {flush_threshold, non_neg_integer()} | {sync_interval, non_neg_integer()} | {sync_size, non_neg_integer()} | {sync_on, lager:log_level()} | {check_interval, non_neg_integer()} | {formatter, atom()} | {formatter_config, term()}

Function Index


Function Details


config_to_id(Config) -> any()


init(LogFileConfig::[option(), ...]) -> {ok, #state{name = string(), level = {mask, integer()}, fd = file:io_device() | undefined, inode = integer() | undefined, flap = boolean(), size = integer(), date = undefined | string(), count = integer(), rotator = atom(), shaper = lager_shaper(), formatter = atom(), formatter_config = any(), sync_on = {mask, integer()}, check_interval = non_neg_integer(), sync_interval = non_neg_integer(), sync_size = non_neg_integer(), last_check = erlang:timestamp()}} | {error, {fatal, bad_config}}

Generated by EDoc