0.0.5 • Published 1 year ago

electron-log-unconfig v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

electron-log

NPM version

Declare

Forked from electron-log@4.4.8

changes in this fork

  • 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 to package.json and configure the log output method.
  • If you don't add config file or field, it works as normal electron-log.

Usage

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.

Options

Both config file and field have samed options.

{
  "filePath": "D:/logs",
  "fileName": "Test-{y}-{m}-{d}",
  "maxSize": 100,
  "segmentation": true,
  "prefixPkgName": false,
  "countLength": 3
}

filePath

  • Required: false
  • Type: string

The log output path.

fileName

  • 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

maxSize

  • Required: false
  • Type: number
  • Default: 1024

Single file's size. The unit ofmeasurement is magabytes.

segmentation

  • Required: false
  • Type: boolean
  • Default: false

Whether to enable file splitting.

prefixPkgName

  • Required: false
  • Type: boolean
  • Default: false

Whether to add package name as prefix.

countLength

  • 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.

Future

Maybe i will rewrite electron-log.But for now i'm just going to add a few methods to meet my needs.

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago