electron-log-unconfig
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

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.

Package Sidebar

Install

npm i electron-log-unconfig

Weekly Downloads

134

Version

0.0.5

License

MIT

Unpacked Size

108 kB

Total Files

38

Last publish

Collaborators

  • crossoverzqj