require("base-logger/appenders/file")(group, pattern, appenderOptions) → {module:base-logger~LoggerBase}
This function returns a logger which logs a decorated message in a file.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
group |
String | the name of the group for which the logger should be returned |
|
pattern |
string | module:base-logger~LogPattern |
<optional> |
the pattern used for formatting the logs. If the value is
a |
appenderOptions |
module:base-logger/appenders/file~AppenderOptions | the options used to configure the file appender |
- Source:
Returns:
an object with debug
, info
, warn
and error
functions.
file appender is used by the logger to log messages in a file
- Source:
Requires
Type Definitions
-
AppenderOptions
-
- Source:
Properties:
Name Type Argument Description path
string which is the path to the file where the logs should be saved. The
path
should be without extension.roll
string <optional>
if used, defines when new log files should be created and how it should be rolled.
roll
can be any momentjs date format. the file name of log files will be appended with the time formated in the specified format and whenever the parsed value changes, a new log file will be created.For example,
a value of
YYYYM
will create one file for each month.For Jan 2015, the filename will be
<<value of path>>-20151.log
.