@arashi/logger
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -7,4 +7,12 @@ ### Changelog | ||
#### [v2.1.0](https://github.com/arashijs/logger/compare/v2.0.1...v2.1.0) | ||
- eslint upgrade [`725c4ee`](https://github.com/arashijs/logger/commit/725c4ee022cae967685508795a7c49c447dc81d6) | ||
- deproll [`d617ac0`](https://github.com/arashijs/logger/commit/d617ac09d7708cf2fd53212fa4b3254c47d82102) | ||
- added max file size [`c50e05b`](https://github.com/arashijs/logger/commit/c50e05b5672d1a712d72477d6db2692dc6329075) | ||
#### [v2.0.1](https://github.com/arashijs/logger/compare/v2.0.0...v2.0.1) | ||
> 18 August 2021 | ||
### [v2.0.0](https://github.com/arashijs/logger/compare/v1.0.0...v2.0.0) | ||
@@ -11,0 +19,0 @@ |
@@ -1,2 +0,2 @@ | ||
[@arashi/logger - v2.0.1](../README.md) / [Exports](../modules.md) / [Logger](../modules/Logger.md) / Logger | ||
[@arashi/logger - v2.1.0](../README.md) / [Exports](../modules.md) / [Logger](../modules/Logger.md) / Logger | ||
@@ -41,2 +41,3 @@ # Class: Logger | ||
- [getLogLevel](Logger.Logger-1.md#getloglevel) | ||
- [getMaxFileSize](Logger.Logger-1.md#getmaxfilesize) | ||
- [getMaxListeners](Logger.Logger-1.md#getmaxlisteners) | ||
@@ -63,3 +64,3 @@ - [info](Logger.Logger-1.md#info) | ||
- [warn](Logger.Logger-1.md#warn) | ||
- [getEventListener](Logger.Logger-1.md#geteventlistener) | ||
- [getEventListeners](Logger.Logger-1.md#geteventlisteners) | ||
- [listenerCount](Logger.Logger-1.md#listenercount) | ||
@@ -89,3 +90,3 @@ - [on](Logger.Logger-1.md#on) | ||
[src/Logger.ts:34](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L34) | ||
[src/Logger.ts:36](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L36) | ||
@@ -104,3 +105,3 @@ ## Properties | ||
node_modules/@types/node/events.d.ts:94 | ||
node_modules/@types/node/events.d.ts:273 | ||
@@ -121,3 +122,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:99 | ||
node_modules/@types/node/events.d.ts:278 | ||
@@ -136,3 +137,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:100 | ||
node_modules/@types/node/events.d.ts:279 | ||
@@ -159,3 +160,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:93 | ||
node_modules/@types/node/events.d.ts:272 | ||
@@ -180,3 +181,3 @@ ## Methods | ||
[src/Logger.ts:161](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L161) | ||
[src/Logger.ts:170](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L170) | ||
@@ -195,3 +196,3 @@ ___ | ||
[src/Logger.ts:157](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L157) | ||
[src/Logger.ts:166](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L166) | ||
@@ -216,3 +217,3 @@ ___ | ||
[src/Logger.ts:166](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L166) | ||
[src/Logger.ts:175](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L175) | ||
@@ -237,3 +238,3 @@ ___ | ||
[src/Logger.ts:133](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L133) | ||
[src/Logger.ts:142](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L142) | ||
@@ -267,3 +268,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:120 | ||
node_modules/@types/node/events.d.ts:299 | ||
@@ -290,3 +291,3 @@ ___ | ||
[src/Logger.ts:228](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L228) | ||
[src/Logger.ts:237](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L237) | ||
@@ -313,3 +314,3 @@ ___ | ||
[src/Logger.ts:252](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L252) | ||
[src/Logger.ts:261](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L261) | ||
@@ -337,3 +338,3 @@ ___ | ||
[src/Logger.ts:272](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L272) | ||
[src/Logger.ts:281](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L281) | ||
@@ -403,3 +404,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:376 | ||
node_modules/@types/node/events.d.ts:555 | ||
@@ -426,3 +427,3 @@ ___ | ||
[src/Logger.ts:248](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L248) | ||
[src/Logger.ts:257](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L257) | ||
@@ -463,3 +464,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:435 | ||
node_modules/@types/node/events.d.ts:614 | ||
@@ -478,3 +479,3 @@ ___ | ||
[src/Logger.ts:153](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L153) | ||
[src/Logger.ts:162](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L162) | ||
@@ -493,6 +494,20 @@ ___ | ||
[src/Logger.ts:129](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L129) | ||
[src/Logger.ts:138](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L138) | ||
___ | ||
### getMaxFileSize | ||
▸ **getMaxFileSize**(): `number` | ||
#### Returns | ||
`number` | ||
#### Defined in | ||
[src/Logger.ts:130](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L130) | ||
___ | ||
### getMaxListeners | ||
@@ -517,3 +532,3 @@ | ||
node_modules/@types/node/events.d.ts:292 | ||
node_modules/@types/node/events.d.ts:471 | ||
@@ -540,3 +555,3 @@ ___ | ||
[src/Logger.ts:238](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L238) | ||
[src/Logger.ts:247](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L247) | ||
@@ -569,3 +584,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:382 | ||
node_modules/@types/node/events.d.ts:561 | ||
@@ -606,3 +621,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:305 | ||
node_modules/@types/node/events.d.ts:484 | ||
@@ -630,3 +645,3 @@ ___ | ||
[src/Logger.ts:198](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L198) | ||
[src/Logger.ts:207](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L207) | ||
@@ -660,3 +675,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:265 | ||
node_modules/@types/node/events.d.ts:444 | ||
@@ -714,3 +729,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:151 | ||
node_modules/@types/node/events.d.ts:330 | ||
@@ -766,3 +781,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:180 | ||
node_modules/@types/node/events.d.ts:359 | ||
@@ -807,3 +822,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:400 | ||
node_modules/@types/node/events.d.ts:579 | ||
@@ -846,3 +861,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:416 | ||
node_modules/@types/node/events.d.ts:595 | ||
@@ -900,3 +915,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:335 | ||
node_modules/@types/node/events.d.ts:514 | ||
@@ -935,3 +950,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:276 | ||
node_modules/@types/node/events.d.ts:455 | ||
@@ -956,3 +971,3 @@ ___ | ||
[src/Logger.ts:137](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L137) | ||
[src/Logger.ts:146](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L146) | ||
@@ -1061,3 +1076,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:260 | ||
node_modules/@types/node/events.d.ts:439 | ||
@@ -1082,3 +1097,3 @@ ___ | ||
[src/Logger.ts:144](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L144) | ||
[src/Logger.ts:153](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L153) | ||
@@ -1103,3 +1118,3 @@ ___ | ||
[src/Logger.ts:125](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L125) | ||
[src/Logger.ts:134](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L134) | ||
@@ -1137,3 +1152,3 @@ ___ | ||
node_modules/@types/node/events.d.ts:286 | ||
node_modules/@types/node/events.d.ts:465 | ||
@@ -1160,3 +1175,3 @@ ___ | ||
[src/Logger.ts:223](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L223) | ||
[src/Logger.ts:232](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L232) | ||
@@ -1185,3 +1200,3 @@ ___ | ||
[src/Logger.ts:218](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L218) | ||
[src/Logger.ts:227](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L227) | ||
@@ -1208,3 +1223,3 @@ ___ | ||
[src/Logger.ts:233](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L233) | ||
[src/Logger.ts:242](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L242) | ||
@@ -1231,12 +1246,37 @@ ___ | ||
[src/Logger.ts:243](https://github.com/arashijs/logger/blob/ea93ee1/src/Logger.ts#L243) | ||
[src/Logger.ts:252](https://github.com/arashijs/logger/blob/c50e05b/src/Logger.ts#L252) | ||
___ | ||
### getEventListener | ||
### getEventListeners | ||
▸ `Static` **getEventListener**(`emitter`, `name`): `Function`[] | ||
▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] | ||
Returns a list listener for a specific emitter event name. | ||
Returns a copy of the array of listeners for the event named `eventName`. | ||
For `EventEmitter`s this behaves exactly the same as calling `.listeners` on | ||
the emitter. | ||
For `EventTarget`s this is the only way to get the event listeners for the | ||
event target. This is useful for debugging and diagnostic purposes. | ||
```js | ||
const { getEventListeners, EventEmitter } = require('events'); | ||
{ | ||
const ee = new EventEmitter(); | ||
const listener = () => console.log('Events are fun'); | ||
ee.on('foo', listener); | ||
getEventListeners(ee, 'foo'); // [listener] | ||
} | ||
{ | ||
const et = new EventTarget(); | ||
const listener = () => console.log('Events are fun'); | ||
et.addEventListener('foo', listener); | ||
getEventListeners(et, 'foo'); // [listener] | ||
} | ||
``` | ||
**`since`** v15.2.0 | ||
#### Parameters | ||
@@ -1255,7 +1295,7 @@ | ||
EventEmitter.getEventListener | ||
EventEmitter.getEventListeners | ||
#### Defined in | ||
node_modules/@types/node/events.d.ts:83 | ||
node_modules/@types/node/events.d.ts:262 | ||
@@ -1268,10 +1308,23 @@ ___ | ||
**`deprecated`** since v4.0.0 | ||
A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. | ||
```js | ||
const { EventEmitter, listenerCount } = require('events'); | ||
const myEmitter = new EventEmitter(); | ||
myEmitter.on('event', () => {}); | ||
myEmitter.on('event', () => {}); | ||
console.log(listenerCount(myEmitter, 'event')); | ||
// Prints: 2 | ||
``` | ||
**`since`** v0.9.12 | ||
**`deprecated`** Since v3.2.0 - Use `listenerCount` instead. | ||
#### Parameters | ||
| Name | Type | | ||
| :------ | :------ | | ||
| `emitter` | `EventEmitter` | | ||
| `eventName` | `string` \| `symbol` | | ||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `emitter` | `EventEmitter` | The emitter to query | | ||
| `eventName` | `string` \| `symbol` | The event name | | ||
@@ -1288,3 +1341,3 @@ #### Returns | ||
node_modules/@types/node/events.d.ts:79 | ||
node_modules/@types/node/events.d.ts:234 | ||
@@ -1297,9 +1350,65 @@ ___ | ||
```js | ||
const { on, EventEmitter } = require('events'); | ||
(async () => { | ||
const ee = new EventEmitter(); | ||
// Emit later on | ||
process.nextTick(() => { | ||
ee.emit('foo', 'bar'); | ||
ee.emit('foo', 42); | ||
}); | ||
for await (const event of on(ee, 'foo')) { | ||
// The execution of this inner block is synchronous and it | ||
// processes one event at a time (even with await). Do not use | ||
// if concurrent execution is required. | ||
console.log(event); // prints ['bar'] [42] | ||
} | ||
// Unreachable here | ||
})(); | ||
``` | ||
Returns an `AsyncIterator` that iterates `eventName` events. It will throw | ||
if the `EventEmitter` emits `'error'`. It removes all listeners when | ||
exiting the loop. The `value` returned by each iteration is an array | ||
composed of the emitted event arguments. | ||
An `AbortSignal` can be used to cancel waiting on events: | ||
```js | ||
const { on, EventEmitter } = require('events'); | ||
const ac = new AbortController(); | ||
(async () => { | ||
const ee = new EventEmitter(); | ||
// Emit later on | ||
process.nextTick(() => { | ||
ee.emit('foo', 'bar'); | ||
ee.emit('foo', 42); | ||
}); | ||
for await (const event of on(ee, 'foo', { signal: ac.signal })) { | ||
// The execution of this inner block is synchronous and it | ||
// processes one event at a time (even with await). Do not use | ||
// if concurrent execution is required. | ||
console.log(event); // prints ['bar'] [42] | ||
} | ||
// Unreachable here | ||
})(); | ||
process.nextTick(() => ac.abort()); | ||
``` | ||
**`since`** v13.6.0, v12.16.0 | ||
#### Parameters | ||
| Name | Type | | ||
| :------ | :------ | | ||
| `emitter` | `EventEmitter` | | ||
| `eventName` | `string` | | ||
| `options?` | `StaticEventEmitterOptions` | | ||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `emitter` | `EventEmitter` | - | | ||
| `eventName` | `string` | The name of the event being listened for | | ||
| `options?` | `StaticEventEmitterOptions` | - | | ||
@@ -1310,2 +1419,4 @@ #### Returns | ||
that iterates `eventName` events emitted by the `emitter` | ||
#### Inherited from | ||
@@ -1317,3 +1428,3 @@ | ||
node_modules/@types/node/events.d.ts:77 | ||
node_modules/@types/node/events.d.ts:217 | ||
@@ -1326,2 +1437,84 @@ ___ | ||
Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given | ||
event or that is rejected if the `EventEmitter` emits `'error'` while waiting. | ||
The `Promise` will resolve with an array of all the arguments emitted to the | ||
given event. | ||
This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event | ||
semantics and does not listen to the `'error'` event. | ||
```js | ||
const { once, EventEmitter } = require('events'); | ||
async function run() { | ||
const ee = new EventEmitter(); | ||
process.nextTick(() => { | ||
ee.emit('myevent', 42); | ||
}); | ||
const [value] = await once(ee, 'myevent'); | ||
console.log(value); | ||
const err = new Error('kaboom'); | ||
process.nextTick(() => { | ||
ee.emit('error', err); | ||
}); | ||
try { | ||
await once(ee, 'myevent'); | ||
} catch (err) { | ||
console.log('error happened', err); | ||
} | ||
} | ||
run(); | ||
``` | ||
The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the | ||
'`error'` event itself, then it is treated as any other kind of event without | ||
special handling: | ||
```js | ||
const { EventEmitter, once } = require('events'); | ||
const ee = new EventEmitter(); | ||
once(ee, 'error') | ||
.then(([err]) => console.log('ok', err.message)) | ||
.catch((err) => console.log('error', err.message)); | ||
ee.emit('error', new Error('boom')); | ||
// Prints: ok boom | ||
``` | ||
An `AbortSignal` can be used to cancel waiting for the event: | ||
```js | ||
const { EventEmitter, once } = require('events'); | ||
const ee = new EventEmitter(); | ||
const ac = new AbortController(); | ||
async function foo(emitter, event, signal) { | ||
try { | ||
await once(emitter, event, { signal }); | ||
console.log('event emitted!'); | ||
} catch (error) { | ||
if (error.name === 'AbortError') { | ||
console.error('Waiting for the event was canceled!'); | ||
} else { | ||
console.error('There was an error', error.message); | ||
} | ||
} | ||
} | ||
foo(ee, 'foo', ac.signal); | ||
ac.abort(); // Abort waiting for the event | ||
ee.emit('foo'); // Prints: Waiting for the event was canceled! | ||
``` | ||
**`since`** v11.13.0, v10.16.0 | ||
#### Parameters | ||
@@ -1345,3 +1538,3 @@ | ||
node_modules/@types/node/events.d.ts:75 | ||
node_modules/@types/node/events.d.ts:157 | ||
@@ -1368,2 +1561,2 @@ ▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> | ||
node_modules/@types/node/events.d.ts:76 | ||
node_modules/@types/node/events.d.ts:158 |
@@ -1,2 +0,2 @@ | ||
[@arashi/logger - v2.0.1](../README.md) / [Exports](../modules.md) / [LogEvent](../modules/LogEvent.md) / LogEvent | ||
[@arashi/logger - v2.1.0](../README.md) / [Exports](../modules.md) / [LogEvent](../modules/LogEvent.md) / LogEvent | ||
@@ -21,2 +21,2 @@ # Enumeration: LogEvent | ||
[src/LogEvent.ts:17](https://github.com/arashijs/logger/blob/ea93ee1/src/LogEvent.ts#L17) | ||
[src/LogEvent.ts:17](https://github.com/arashijs/logger/blob/c50e05b/src/LogEvent.ts#L17) |
@@ -1,2 +0,2 @@ | ||
[@arashi/logger - v2.0.1](../README.md) / [Exports](../modules.md) / [LogLevel](../modules/LogLevel.md) / LogLevel | ||
[@arashi/logger - v2.1.0](../README.md) / [Exports](../modules.md) / [LogLevel](../modules/LogLevel.md) / LogLevel | ||
@@ -27,3 +27,3 @@ # Enumeration: LogLevel | ||
[src/LogLevel.ts:8](https://github.com/arashijs/logger/blob/ea93ee1/src/LogLevel.ts#L8) | ||
[src/LogLevel.ts:8](https://github.com/arashijs/logger/blob/c50e05b/src/LogLevel.ts#L8) | ||
@@ -38,3 +38,3 @@ ___ | ||
[src/LogLevel.ts:3](https://github.com/arashijs/logger/blob/ea93ee1/src/LogLevel.ts#L3) | ||
[src/LogLevel.ts:3](https://github.com/arashijs/logger/blob/c50e05b/src/LogLevel.ts#L3) | ||
@@ -49,3 +49,3 @@ ___ | ||
[src/LogLevel.ts:6](https://github.com/arashijs/logger/blob/ea93ee1/src/LogLevel.ts#L6) | ||
[src/LogLevel.ts:6](https://github.com/arashijs/logger/blob/c50e05b/src/LogLevel.ts#L6) | ||
@@ -60,3 +60,3 @@ ___ | ||
[src/LogLevel.ts:5](https://github.com/arashijs/logger/blob/ea93ee1/src/LogLevel.ts#L5) | ||
[src/LogLevel.ts:5](https://github.com/arashijs/logger/blob/c50e05b/src/LogLevel.ts#L5) | ||
@@ -71,3 +71,3 @@ ___ | ||
[src/LogLevel.ts:9](https://github.com/arashijs/logger/blob/ea93ee1/src/LogLevel.ts#L9) | ||
[src/LogLevel.ts:9](https://github.com/arashijs/logger/blob/c50e05b/src/LogLevel.ts#L9) | ||
@@ -82,3 +82,3 @@ ___ | ||
[src/LogLevel.ts:7](https://github.com/arashijs/logger/blob/ea93ee1/src/LogLevel.ts#L7) | ||
[src/LogLevel.ts:7](https://github.com/arashijs/logger/blob/c50e05b/src/LogLevel.ts#L7) | ||
@@ -93,2 +93,2 @@ ___ | ||
[src/LogLevel.ts:4](https://github.com/arashijs/logger/blob/ea93ee1/src/LogLevel.ts#L4) | ||
[src/LogLevel.ts:4](https://github.com/arashijs/logger/blob/c50e05b/src/LogLevel.ts#L4) |
@@ -1,2 +0,2 @@ | ||
[@arashi/logger - v2.0.1](../README.md) / [Exports](../modules.md) / [ILogEvent](../modules/ILogEvent.md) / ILogEvent | ||
[@arashi/logger - v2.1.0](../README.md) / [Exports](../modules.md) / [ILogEvent](../modules/ILogEvent.md) / ILogEvent | ||
@@ -22,3 +22,3 @@ # Interface: ILogEvent | ||
[src/ILogEvent.ts:20](https://github.com/arashijs/logger/blob/ea93ee1/src/ILogEvent.ts#L20) | ||
[src/ILogEvent.ts:20](https://github.com/arashijs/logger/blob/c50e05b/src/ILogEvent.ts#L20) | ||
@@ -33,2 +33,2 @@ ___ | ||
[src/ILogEvent.ts:19](https://github.com/arashijs/logger/blob/ea93ee1/src/ILogEvent.ts#L19) | ||
[src/ILogEvent.ts:19](https://github.com/arashijs/logger/blob/c50e05b/src/ILogEvent.ts#L19) |
@@ -1,4 +0,4 @@ | ||
[@arashi/logger - v2.0.1](README.md) / Exports | ||
[@arashi/logger - v2.1.0](README.md) / Exports | ||
# @arashi/logger - v2.0.1 | ||
# @arashi/logger - v2.1.0 | ||
@@ -5,0 +5,0 @@ ## Table of contents |
@@ -1,2 +0,2 @@ | ||
[@arashi/logger - v2.0.1](../README.md) / [Exports](../modules.md) / api | ||
[@arashi/logger - v2.1.0](../README.md) / [Exports](../modules.md) / api | ||
@@ -3,0 +3,0 @@ # Module: api |
@@ -1,2 +0,2 @@ | ||
[@arashi/logger - v2.0.1](../README.md) / [Exports](../modules.md) / ILogEvent | ||
[@arashi/logger - v2.1.0](../README.md) / [Exports](../modules.md) / ILogEvent | ||
@@ -3,0 +3,0 @@ # Module: ILogEvent |
@@ -1,2 +0,2 @@ | ||
[@arashi/logger - v2.0.1](../README.md) / [Exports](../modules.md) / LogEvent | ||
[@arashi/logger - v2.1.0](../README.md) / [Exports](../modules.md) / LogEvent | ||
@@ -3,0 +3,0 @@ # Module: LogEvent |
@@ -1,2 +0,2 @@ | ||
[@arashi/logger - v2.0.1](../README.md) / [Exports](../modules.md) / Logger | ||
[@arashi/logger - v2.1.0](../README.md) / [Exports](../modules.md) / Logger | ||
@@ -3,0 +3,0 @@ # Module: Logger |
@@ -1,2 +0,2 @@ | ||
[@arashi/logger - v2.0.1](../README.md) / [Exports](../modules.md) / LogLevel | ||
[@arashi/logger - v2.1.0](../README.md) / [Exports](../modules.md) / LogLevel | ||
@@ -3,0 +3,0 @@ # Module: LogLevel |
@@ -1,3 +0,3 @@ | ||
@arashi/logger - v2.0.1 / [Exports](modules.md) | ||
@arashi/logger - v2.1.0 / [Exports](modules.md) | ||
# logger |
@@ -10,2 +10,3 @@ /// <reference types="node" /> | ||
constructor(serviceName?: string, logLevel?: LogLevel, logLocation?: string); | ||
getMaxFileSize(): number; | ||
setLogLevel(level: LogLevel): void; | ||
@@ -12,0 +13,0 @@ getLogLevel(): LogLevel; |
@@ -14,2 +14,3 @@ "use strict"; | ||
const F_FG_CYAN = '\x1b[36m'; | ||
const DEFAULT_MAX_FILE_SIZE = 52428800; | ||
class Logger extends events_1.EventEmitter { | ||
@@ -37,2 +38,3 @@ constructor(serviceName = 'Generic', logLevel = LogLevel_1.LogLevel.INFO, logLocation) { | ||
level: logLevel, | ||
maxsize: this.getMaxFileSize(), | ||
format: Winston.format.combine(Winston.format.json(), Winston.format.errors({ stack: true }), Winston.format((info, opts) => { | ||
@@ -59,2 +61,3 @@ const MESSAGE = Symbol.for('message'); | ||
filename: Path.resolve(this.$logLocation, `${serviceName}.log`), | ||
maxsize: this.getMaxFileSize(), | ||
level: logLevel, | ||
@@ -65,2 +68,3 @@ format: Winston.format.combine(Winston.format.simple(), Winston.format.errors({ stack: true }), format) | ||
filename: Path.resolve(this.$logLocation, `${serviceName}.errors.log`), | ||
maxsize: this.getMaxFileSize(), | ||
level: LogLevel_1.LogLevel.WARN, | ||
@@ -81,2 +85,5 @@ format: Winston.format.combine(Winston.format.simple(), Winston.format.errors({ stack: true }), format) | ||
} | ||
getMaxFileSize() { | ||
return DEFAULT_MAX_FILE_SIZE; | ||
} | ||
setLogLevel(level) { | ||
@@ -83,0 +90,0 @@ this.$logger.level = level; |
{ | ||
"name": "@arashi/logger", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Logger", | ||
@@ -14,13 +14,13 @@ "main": "./lib/api.js", | ||
"devDependencies": { | ||
"@totalpave/eslint-plugin": "5.0.0", | ||
"@types/jest": "27.0.1", | ||
"@types/node": "16.6.1", | ||
"@typescript-eslint/eslint-plugin": "4.29.2", | ||
"@typescript-eslint/parser": "4.29.2", | ||
"@totalpave/eslint-plugin": "6.0.0", | ||
"@types/jest": "27.0.2", | ||
"@types/node": "16.11.6", | ||
"@typescript-eslint/eslint-plugin": "5.2.0", | ||
"@typescript-eslint/parser": "5.2.0", | ||
"auto-changelog": "2.3.0", | ||
"eslint": "7.32.0", | ||
"jest": "27.0.6", | ||
"eslint": "8.1.0", | ||
"jest": "27.3.1", | ||
"nyc": "15.1.0", | ||
"ts-jest": "27.0.5", | ||
"ts-node": "10.2.0", | ||
"ts-node": "10.4.0", | ||
"typedoc": "0.21.5", | ||
@@ -27,0 +27,0 @@ "typedoc-plugin-markdown": "3.10.4", |
@@ -28,2 +28,4 @@ // Copyright (C) 2020 Norman Breau | ||
const DEFAULT_MAX_FILE_SIZE: number = 52428800; // 50MB | ||
export class Logger extends EventEmitter { | ||
@@ -68,2 +70,3 @@ private $filters: Array<RegExp>; | ||
level: logLevel, | ||
maxsize: this.getMaxFileSize(), | ||
format: Winston.format.combine( | ||
@@ -94,2 +97,3 @@ Winston.format.json(), | ||
filename: Path.resolve(this.$logLocation, `${serviceName}.log`), | ||
maxsize: this.getMaxFileSize(), | ||
level: logLevel, | ||
@@ -104,2 +108,3 @@ format: Winston.format.combine( | ||
filename: Path.resolve(this.$logLocation, `${serviceName}.errors.log`), | ||
maxsize: this.getMaxFileSize(), | ||
level: LogLevel.WARN, | ||
@@ -129,2 +134,6 @@ format: Winston.format.combine( | ||
public getMaxFileSize(): number { | ||
return DEFAULT_MAX_FILE_SIZE; | ||
} | ||
public setLogLevel(level: LogLevel): void { | ||
@@ -131,0 +140,0 @@ this.$logger.level = level; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86373
637