class FileHandler
extends WriterHandler
import { FileHandler } from "https://deno.land/std@0.193.0/log/handlers.ts";
This handler will output to a file using an optional mode (default is a
,
e.g. append). The file will grow indefinitely. It uses a buffer for writing
to file. Logs can be manually flushed with fileHandler.flush()
. Log
messages with a log level greater than error are immediately flushed. Logs
are also flushed on process completion.
Behavior of the log modes is as follows:
'a'
- Default mode. Appends new log messages to the end of an existing log file, or create a new log file if none exists.'w'
- Upon creation of the handler, any existing log file will be removed and a new one created.'x'
- This will create a new log file and throw an error if one already exists.
This handler requires --allow-write
permission on the log file.
Constructors
new
FileHandler(levelName: LevelName, options: FileHandlerOptions)Properties
protected
_buf: BufWriterSyncprotected
_encoder: TextEncoderprotected
_file: Deno.FsFile | undefinedprotected
_mode: LogModeprotected
_openOptions: Deno.OpenOptions