package easy_logging_yojson

  1. Overview
  2. Docs
include module type of struct include Easy_logging.Handlers.FileHandler end

Module to create handlers that output to a file.

Module to create handlers that output to a file.

Module to create handlers that output to a file.

type config = Easy_logging.Handlers.FileHandler.config = {
  1. logs_folder : string;
    (*

    Path in which logs files will be written.

    *)
  2. truncate : bool;
    (*

    Truncate/append if file already exists.

    *)
  3. file_perms : int;
    (*

    Unix file permissions.

    *)
  4. date_prefix : string option;
    (*

    Optional date prefix format string.

    *)
  5. versioning : int option;
    (*

    Optionaly generate new file name.

    *)
  6. suffix : string;
    (*

    Constant suffix.

    *)
}

Configuration when creating a file handler.

  • The date_prefix value is an optional Calender Printer String (as specified in the Calendar documentation), that will format the time at which the handler is created, and used as a prefix.
  • If the versioning value is not None, a versionning number is appended to the filename, based on already existing files. The integer gives the padding of versionning numbers. THIS OPTION MIGHT DISAPPEAR IN FUTURE RELEASES.
val default_config : config
val generate_prefix : config -> string
val generate_filename : config -> string -> string
val create_file : config -> string -> Stdlib.out_channel
val make : ?config:config -> Easy_logging__.Logging_types.level -> string -> Easy_logging.Handlers.t

make ~config level filename_base creates a Handler that will output logs to the file created from filename_base and config

val make_rotating : ?config:config -> Easy_logging__.Logging_types.level -> string -> int -> int -> Easy_logging.Handlers.t

make_rotating ~config level filename_base max_kbytes backup_count creates a Handler that will output logs to a rotating set of files. The files are from filename_base and config. When the size of a log file is about to exceed max_kbytes kb, a new file is created, and older log files are renamed. See the python RotatingFileHandler.

type config_ = config = {
  1. logs_folder : string;
  2. truncate : bool;
  3. file_perms : int;
  4. date_prefix : string option;
  5. versioning : int option;
  6. suffix : string;
}
val config__to_yojson : config_ -> Yojson.Safe.t
val config__of_yojson : Yojson.Safe.t -> config_ Ppx_deriving_yojson_runtime.error_or
val config_to_yojson : config_ -> Yojson.Safe.t
val config_of_yojson : Yojson.Safe.t -> config_ Ppx_deriving_yojson_runtime.error_or
OCaml

Innovation. Community. Security.