Forked from electron-log
@4.4.8
- You can add a
.logrc
or.logrc.json
file in the project root directory and configure the log output method. - You can add a
.logrc
field topackage.json
and configure the log output method. - If you don't add config file or field, it works as normal
electron-log
.
npm install electron-log-unconfig -D
And then you can add a config file named .logrc
or .logrc.json
to root or add a .logrc
field to package.json
.
Both config file and field have samed options.
{
"filePath": "D:/logs",
"fileName": "Test-{y}-{m}-{d}",
"maxSize": 100,
"segmentation": true,
"prefixPkgName": false,
"countLength": 3
}
- Required:
false
- Type:
string
The log output path.
- Required:
false
- Type:
string
File name's template. It will replace with date.
For example(Today is 2024/2/1):
Test-{y}-{m}-{d} -> filename: Test-2024-2-1.log
Test-{y}-{m} -> filename: Test-2024-2.log
Test-{y} -> filename: Test-2024.log
Test-{y}-AA{m}-BB{d} -> filename: Test-2024-AA2-BB1.log
- Required:
false
- Type:
number
- Default:
1024
Single file's size. The unit ofmeasurement is magabytes.
- Required:
false
- Type:
boolean
- Default:
false
Whether to enable file splitting.
- Required:
false
- Type:
boolean
- Default:
false
Whether to add package name as prefix.
- Required:
false
- Type:
number
- Default: 3
Default filename(if segmentation is true) is xxx.001.log
.
If set countLength to 5, filename is xxx.00001.log
.
Maybe i will rewrite electron-log.But for now i'm just going to add a few methods to meet my needs.