Next: , Previous: logging port-log, Up: Top


13 (logging rotating-log)

13.1 Overview

This module defines a log handler for text logs that rotate when they get to be a user-defined size. This is similar to the behavior of many UNIX standard log files. See logging logger, for more information in general on log handlers.

13.2 Usage

— Class: <rotating-log>

This is a log handler which writes text logs that rotate when they reach a configurable size limit.

Keywords recognized by <rotating-log> on creation are:

#:num-files
This is the number of log files you want the logger to use. Default is 4.
#:size-limit
This is the size, in bytes, a log file must get before the logs get rotated. Default is 1MB (104876 bytes).
#:file-name
This is the base of the log file name. Default is “logfile”. Numbers will be appended to the file name representing the log number. The newest log file is always “NAME.1”.
#:formatter
Allows the user to provide a function to use as the log formatter for this handler. See logging logger <log-handler>, for details.

Example of creating a <rotating-log>:

           (make <rotating-log>
                #:num-files 3
                #:size-limit 1024
                #:file-name "test-log-file"))