diff --git a/assets/highlight.css b/assets/highlight.css index 9010506..12a0168 100644 --- a/assets/highlight.css +++ b/assets/highlight.css @@ -17,8 +17,12 @@ --dark-hl-7: #6A9955; --light-hl-8: #267F99; --dark-hl-8: #4EC9B0; - --light-hl-9: #CD3131; - --dark-hl-9: #F44747; + --light-hl-9: #098658; + --dark-hl-9: #B5CEA8; + --light-hl-10: #000000; + --dark-hl-10: #C8C8C8; + --light-hl-11: #000000FF; + --dark-hl-11: #D4D4D4; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } @@ -34,6 +38,8 @@ --hl-7: var(--light-hl-7); --hl-8: var(--light-hl-8); --hl-9: var(--light-hl-9); + --hl-10: var(--light-hl-10); + --hl-11: var(--light-hl-11); --code-background: var(--light-code-background); } } @@ -48,6 +54,8 @@ --hl-7: var(--dark-hl-7); --hl-8: var(--dark-hl-8); --hl-9: var(--dark-hl-9); + --hl-10: var(--dark-hl-10); + --hl-11: var(--dark-hl-11); --code-background: var(--dark-code-background); } } @@ -62,6 +70,8 @@ --hl-7: var(--light-hl-7); --hl-8: var(--light-hl-8); --hl-9: var(--light-hl-9); + --hl-10: var(--light-hl-10); + --hl-11: var(--light-hl-11); --code-background: var(--light-code-background); } @@ -76,6 +86,8 @@ --hl-7: var(--dark-hl-7); --hl-8: var(--dark-hl-8); --hl-9: var(--dark-hl-9); + --hl-10: var(--dark-hl-10); + --hl-11: var(--dark-hl-11); --code-background: var(--dark-code-background); } @@ -89,4 +101,6 @@ .hl-7 { color: var(--hl-7); } .hl-8 { color: var(--hl-8); } .hl-9 { color: var(--hl-9); } +.hl-10 { color: var(--hl-10); } +.hl-11 { color: var(--hl-11); } pre, code { background: var(--code-background); } diff --git a/assets/navigation.js b/assets/navigation.js index 5c5b3fa..f49c184 100644 --- a/assets/navigation.js +++ b/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA5WUS2+DMBCE/4vPqA/SpCq3KI9ekCI1VS9RVDmwIVYd2zJLlKjKf68CNJiXgSs7/oYdBm9+CcIZiUf2NECpL8QhiuKBeOQow4RD/JgPHg545MQhP0yExHMdEhwYDzUI4m3ukF3CeDiHGJmgyKT4kJwzES0ZhwK8T0RwGxZoy7Gy7eTl6rSaDXUZiF+jBnocYpCdGGQRygSHWdxODLMArQdagNZdFr6MIujmZjILTGlAvKwUxstqIevImrgTPJMilmZNTlQzujN7XhKWgSO3BiyXro1Wr9rIvW4NGBMhnOv/Xvq415+nqI7Bl9FKpRE1pZbBKkJLYqlN+3fNcIbIguKp4BNibMoqIxUaS+iZaA67JOoipaJO1FSp9uXuks7Vpkrll1YPWq60QH0Z+XACXsDwou77/U8rxXh6e30emxv6q/dvf/G18NftWRUaS1RNvWICQe9pYL5VY6fc8cQsetynpKbKHlOpnJWQap1siCiPMruqFwLNC6cpc0PYgz2nSFt5t2EzY3vd/gGrUA2rmQcAAA==" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA7VZbW/bNhD+L9pXp6vdJFuDoUDql2GoPQ92saIoAoOWzjIRmtRIKrA39L8PkiybEkWJItOv1nPPc0cej8fzt/8CCUcZPAQ7FErGT8EgSJDcBw/BgUUpAfHz+cObvTyQYBA8YxoFD6NBEO4xiTjQ4OHbhWSbYhJNQEhMkcSMrhghmMYzTOBKvEtpmH28UreYVWXvb78PjGJ9VXrSryUHdOgjUFj0kohYKvtJZBb9JIDznhLAeZfEnMUxdPMWsBayhIOUp2UixayekDqlBu4kHjMqmJomL4hjtFXzvAKsEr4baYTVpDOx6alWoco+Kyt+5ZOnROGqwWon8u37X4Z3KmuRfha8GrCL+TdMJXCKyAdzudiUmI1V5fiY7nbApzRkEaaxyVOFtGrQ6PEgCAkSImMR0Q0WN3AsrAMlli8cy2zL6sc7V9qhsFm9alVTv7u3Uh4zwrhFpDnOPcDcHKQE29guBm5hzVk8ARFynEir8Cp49zD/KmtBViE2trFWrdwCzjnwDoNNtFewZ6g5x/QoORK9ZAsTd/E5vABx8KDRzt2NBQiBYpgxfkByltLQwgXNxl2+pS9oT7iO9sA653D4bLPtOHx2D3J6DEkagYXOGekutTxgaaGTwfqKPH1/UoQwjeCo31r5z1YXVYK4gDmLzzWjqT0pyGrAltYklzE3UAWdAmqhIjngMwjZ1JQUTFdMS0tSgCawTeMuphzUSfWYJObgLpDO0B6T5Pw6sGA7I1tI5yzOC1M99wqi8mtXPzRf/r6ZT/+eztfmtbpiWpaqKa+UenLxqjGnRnf3aqILmyRVUe3LFOvX28UdLScblui8lEXRm1KpdvZNa64ALbgnSCIjX/bRp6UtiHo2tI/iRMMVCJbyELo3VWFvsnS7JSpMV/HcslO5Kjkc/Wp3Z7wAldMDlhJ4r6gbDN2C3vzJIsjZPiMeg7STr1s5ak+Wi/7SVSM35bVEEofOq280d/NGJbLIOxXun3YWB1iF3wyrkrdmweaT7q/9U43i7Mjw/e27ty3uqCd9y3j+IO1/2G6Gby7W/ru9gh1woCGmsaH69PDLhtjfZfdK3eLu6xVxI2vPg9XmYJ9D91T3bYGS5qu37sgCJe4vhAnsUEqktWIN7y78SE+rSj9tEDzjPIR4rD2kdRUee7yaP4Gh61IUPkFzw2UrMLJRGHkMILCQQE3dqDpxOAM9RmeIkDU2TM40vRLtOA1MhWSHvPVt67ZVvbqFx/ObjrOLLYtgi/TJgiZdw7sLc4hQKHsV3YqJ84gy1kdXbaKqhZvmR5RPAyob26Z4xTvqYZoNxrsrSgn0HAl2H0fjS9peZMnXkjf8P9AsVqI9Rb9guV9jArT7DqjhX024X9y6nbsja+AYEfwv8Jn2/5H+ilDAnrGP94jGxYPMvuAbDD1csavEvuXXbprc0OK8yiy5cSTT/lg0jWZs62+2UQuUJJWUbq2/ioVzzVczuKPYa/lre4tfp7S9LjXdzmNl7Q5K/d37w86Fj9DrrafmxQ/KG1cdn1PoqjnlnPHsthijVFi9JysGbqOaPyRwJBn/ioFEKxApsZyTNRi6hV0SrUCmnLq4oFr6+lBVN5ykKtzjjZm9+kuyHuPo0sRjDp1TbAm4qiumrv/TswMWMMfPlg86xcBNcQX/pJhD1Lm9JdB9Y1cQMm4jlMFc/kJ9+h+WiSSeKygAAA==" \ No newline at end of file diff --git a/assets/search.js b/assets/search.js index 281af25..1cc1cdf 100644 --- a/assets/search.js +++ b/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA61Y246jOBD9l5pXK5NyyI231XbPaqSWerUzmhcUtejgpNESQOD0bivKv4+MCZSJTULSjwnnYuq4CswBiuy/EvzgAP/GaQQ+Z5CGOwE+xGkk/gcG+yIBH3ZZtE9E+bX6d/QmdwkwWCdhWYoSfIAjO1fYhGuZFR9nGvX//Srj5RynrdZTtt2KopGSH3mzGH3JosYgDwuRyuZmeuWfxLtIfshChLvHVJJld7y6uIHG0xk1fc5lnKVl4xWnUhSbcE0Na8wwHxxzrzFK1JKv9vhygvc4EY7LdBMn4nrPGn2/5d+hfBtmWzPus15naZkNueGWMNjYsnkfQhm6Nqy69jnd0dsSwywmRP35r5enx1+PTz8a/fewiMPXdt60kGEuM9ID1ZT4I88bk80+XVelrU0axP0e/2RJEqfby1Y18ObaaaEH8brfOotHMHf6/BSlvGCjIDfXb/0WJ1Fn0ndLRzA3++RhUQrL9O16dXA3+8XlFWYUdHNOeSGk/PizM4zaqE6PXgPX73Z6ivf4fYuvMFOgoU40s0rkOZflt85rRVtI05Bg7/B93cdJ9CBKGaehctFP/h5zO+FTVxBlezloBYrwuSsQha1Fe1Ygigv9OmgFxo677H/n3uvK1VN74CII6961OGek4X3NlGy8VqyeK/4B3kVRxlkKPvDRZLQEBptYJJE6J+hlMFhnu51SWNXXfgmloxAa8nUMLBgzvhzNcLFaseDEqC5Uf1QwBBagDYYGjAMLuA3GDdgEWDCxwSYGzAMWeDaYZ8CmwIKpDTY1YDNgwcwGmxmwObBgboPNDdgCWLCwwRYGbAksWNpgS7O8qtpozQE7QVRJ2KMws0BVc+TM80Yen5tIMw5UZceJFWkmgqryaM0EzVBQFR+tsaCZC6r648zqbkaDKgKcW5FmOqhSwIUVaQaEKgi0RoRmRlwFwa0ZcTMjroLgaHPnnX6pGsaaETcz4ioIbs2ImxlxFQT3rEgzI66C4FMr0syIqyC4NSNuZsRVENyaEdcZVRPsXRRSRN/1JAsCPS6jdgjrc+YBXuphx6enyXoAPgX/cDy2w039UkZdkUJP8jOtGdGaXalV1s9SIuMRGe96meqlgMhMiMzkahn9dkNkOJHhfTJJ/VAi3Dnhzh3c6oX+nIukmOgqZnOIbnmLlrZwsJrvUsSNmLlYnbTJ+lzLU5S8+rrQ0khJXBWpv7y1nHHLGbs4ZZJts9MRg9wYqQe6ClJ/8GlZpClcPZFk25eKZ9rRQroqmWTbqPpe0fKWLW3pZnW3F9ldvaRQnfrJIgkRLzKL01meCJDWQldraYFIH80Jl3Q3urpbc2V13CZUEgv25HIWJ5INhK4ddCLqESD0J9BWg9xyzx1bdiC5X9ftVudsx/4l/YKuhtHnPcswQLKv0LWxNPtsmJOacVfNNDXLZWmZKZz0Arf2wopBHuciiVMBfrA6Hn8DcIkTRI8XAAA="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA61YXY+rNhD9L+6rlZsZEvKhqtLV3b1VpZW26q3uC4oiNjhZVAIIyLaraP97ZczHmNgEkn0MOWfOeI5nMD6zLPk3Z2vvzP4J44CtkbPYPwq2ZmEciP8YZ6csYmt2TIJTJPIv5dPJa3GMGGe7yM9zkbM1Yx/8MsLe3xVJ9n4Ro3reH2W6WsC8jfWUHA4ia0IV72mTjPrLEI2z1M9EXDSL6Q3/JN5E9KPIhH98jAuSdkerixspPHep6HNahEmcN1phXIhs7++oYIUZpwNTnDVCkUx5sMYvNbxHiXBsovswEsM1K/T9kn/6xes42Ypxn/QuifNkzIJbwmhhw+Z98AvftmHlf5/THb0tMU7CIdGff98+Pf58fPrRxH/zs9B/aedNCxmn4pIeKKfE1zRtRPaneFeWthJpEPdr/JVEURgfrktVwJtrpwI9iJfTwVo8grlT52+RF1dkJOTm+u1ewyjoTPpu6QjmZp3Uz3JhmL5drQ7uZr0wHyBGQTf7lGaiKN6/dYZRa1X96tVw/Wr1W7xH73s4QEyCxipRz8ogz2mRf+8cK9pC6oIEe4fuyymMggeRF2HsSxX15u8RNxM+NYMgORWjMpCEz81AZKYW7clAZFf6dVQG2o67rn/n3uuGq6b2yCQI695crDNS0x4yJS+1ui9/mS9ZRecMUAt2UPeKqqa5LnuBGy3cSP5aHtliP/rN8tGzrQHbkaepIRL1goaKNCvZ8EpwfWZvIstlrdYMJ85kxTjbhyIK5PedSoGzXXI8ygib6r+fQsaRCAX5MmXcm3JnOlnBZsO9mlA+Lx+UKGDcAwMKNBQy7qEBhRrKYdxzDChHQ80Y92YG1ExDzRn35gbUXEO5jHuuAeVqqAXj3sKAWmioJePe0oBaaqgV497KgFrpVZVFBlP1oVP+sv5GA3QHQJYakM/cieO6OlJ3AWS5wTEidSdAlhxMXoBuBsiqg8kO0P0AWXhwjdq6JyCLDwsjUvcFpAGwNCJ1b0CaACZ3QLcHpQlosgd1e1CagGDSxk6HlC1i9Ad1f1CagEZ/UPcHpQs4MyJ1g1DagHMjUncIpQ1odAh1h1DagEaHUHcIpQ1o6h3UDUJpA5oMQt0gR9rgTDnOJ8sp6sNEd8gBO1I5VM7VN5EVIvhDzVfPUy/foH3bqFuLM9tWIxjn9aw/M5yz9fnjox258pcU6gbJ1LngIpZLYrkDY+XVyYyEmZEws+FhyiMmCeOQMM7gMOqsTMIgCYN9YaLqiEO4C8JdWLjl5+ElF0gxwVbM5kqm5S1b2tLCam45iRoRs7E6bpP8bOlJSkBPRKQ0JE+0JhpGIi3vuloiKamtotU9cMuZtpyplaMOMZTmEJ5TEjlzbOUJ8yg5JPUXM6ksWSjYFlrdX7Ys0pW2poySw7bk6XLUSVuuUXIIyuu3lrdqaSs7q7u/iYe9JF9eYpEkCRGuMrP6aooEIL0Ntt5WAQJ100S4ZLyAbbwoblHeHhEqsQV6fLmwE8hOAtsWrIlqBgl1o092I9mM9giGHUjWa1tueW1k2b+k4cDWcer6wjCNgOwrsG0sxb54m5Caoa1mipqkRW4Yakh6AW29oKptm1IkfTSmv+EsDVMRhbFga2/z8fE/Mzpg3KAaAAA="; \ No newline at end of file diff --git a/classes/index._internal_.AsyncResource.html b/classes/index._internal_.AsyncResource.html new file mode 100644 index 0000000..6a78fd9 --- /dev/null +++ b/classes/index._internal_.AsyncResource.html @@ -0,0 +1,48 @@ +
AsyncResource() is meant to be extended. Instantiating a +new AsyncResource() also triggers init. If triggerAsyncId is omitted then +async_hook.executionAsyncId() is used.
+The type of async event.
+Optional
triggerAsyncId: number | AsyncResourceOptionsThe ID of the execution context that created
+ this async event (default: executionAsyncId()
), or an
+ AsyncResourceOptions object (since v9.3.0)
Static
bindBinds the given function to the current execution context.
+The returned function will have an asyncResource
property referencing
+the AsyncResource
to which the function is bound.
v14.8.0, v12.19.0
+Binds the given function to execute to this AsyncResource
's scope.
The returned function will have an asyncResource
property referencing
+the AsyncResource
to which the function is bound.
The function to bind to the current AsyncResource
.
v14.8.0, v12.19.0
+Call the provided function with the provided arguments in the execution context +of the async resource. This will establish the context, trigger the AsyncHooks +before callbacks, call the function, trigger the AsyncHooks after callbacks, and +then restore the original execution context.
+v9.6.0
+Call all destroy
hooks. This should only ever be called once. An error will
+be thrown if it is called more than once. This must be manually called. If
+the resource is left to be collected by the GC then the destroy
hooks will
+never be called.
A reference to asyncResource
.
Generated using TypeDoc
Static
Optional
prepareOptional override for formatting stack traces
+Static
stackOptional
stackStatic
captureGenerated using TypeDoc
Integrates EventEmitter
with AsyncResource
for EventEmitter
s that require
+manual async tracking. Specifically, all events emitted by instances of
+EventEmitterAsyncResource
will run within its async context.
The EventEmitterAsyncResource class has the same methods and takes the +same options as EventEmitter and AsyncResource themselves.
+if options.name
is not provided when instantiated directly.
v17.4.0, v16.14.0
+Optional
options: EventEmitterAsyncResourceOptionsOnly optional in child class.
+Static
Readonly
errorThis symbol shall be used to install a listener for only monitoring 'error'
+events. Listeners installed using this symbol are called before the regular
+'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
+'error'
event is emitted, therefore the process will still crash if no
+regular 'error'
listener is installed.
Static
Readonly
captureStatic
captureSets or gets the default captureRejection value for all emitters.
+Static
defaultReadonly
asyncThe unique asyncId assigned to the resource.
+Readonly
triggerThe same triggerAsyncId that is passed to the AsyncResource constructor.
+Readonly
asyncThe underlying AsyncResource
+Optional
[captureStatic
onceCreates 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 interface, which has no special'error'
event
+semantics and does not listen to the 'error'
event.
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:
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:
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!
+
+Optional
options: StaticEventEmitterOptionsv11.13.0, v10.16.0
+Optional
options: StaticEventEmitterOptionsStatic
onconst { 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:
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());
+
+The name of the event being listened for
+Optional
options: StaticEventEmitterOptionsthat iterates eventName
events emitted by the emitter
v13.6.0, v12.16.0
+Static
listenerA class method that returns the number of listeners for the given eventName
registered on the given emitter
.
const { EventEmitter, listenerCount } = require('events');
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
+
+The emitter to query
+The event name
+v0.9.12
+Since v3.2.0 - Use listenerCount
instead.
Static
getReturns 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.
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]
}
+
+v15.2.0, v14.17.0
+Static
getReturns the currently set max amount of listeners.
+For EventEmitter
s this behaves exactly the same as calling .getMaxListeners
on
+the emitter.
For EventTarget
s this is the only way to get the max event listeners for the
+event target. If the number of event handlers on a single EventTarget exceeds
+the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
+
+v18.17.0
+Static
setconst {
setMaxListeners,
EventEmitter
} = require('events');
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
+
+Optional
n: numberA non-negative number. The maximum number of listeners per EventTarget
event.
Rest
...eventTargets: (EventEmitter<DefaultEventMap> | _DOMEventTarget)[]v15.4.0
+Static
addExperimental
Listens once to the abort
event on the provided signal
.
Listening to the abort
event on abort signals is unsafe and may
+lead to resource leaks since another third party with the signal can
+call e.stopImmediatePropagation()
. Unfortunately Node.js cannot change
+this since it would violate the web standard. Additionally, the original
+API makes it easy to forget to remove listeners.
This API allows safely using AbortSignal
s in Node.js APIs by solving these
+two issues by listening to the event such that stopImmediatePropagation
does
+not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
+import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
+
+Disposable that removes the abort
listener.
v18.18.0
+Alias for emitter.on(eventName, listener)
.
Rest
...args: any[]v0.1.26
+Adds the listener
function to the end of the listeners array for the
+event named eventName
. No checks are made to see if the listener
has
+already been added. Multiple calls passing the same combination of eventName
and listener
will result in the listener
being added, and called, multiple
+times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
By default, event listeners are invoked in the order they are added. Theemitter.prependListener()
method can be used as an alternative to add the
+event listener to the beginning of the listeners array.
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
+
+The name of the event.
+The callback function
+Rest
...args: any[]v0.1.101
+Adds a one-timelistener
function for the event named eventName
. The
+next time eventName
is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
By default, event listeners are invoked in the order they are added. Theemitter.prependOnceListener()
method can be used as an alternative to add the
+event listener to the beginning of the listeners array.
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
+
+The name of the event.
+The callback function
+Rest
...args: any[]v0.3.0
+Removes the specified listener
from the listener array for the event namedeventName
.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
+
+removeListener()
will remove, at most, one instance of a listener from the
+listener array. If any single listener has been added multiple times to the
+listener array for the specified eventName
, then removeListener()
must be
+called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
+time of emitting are called in order. This implies that anyremoveListener()
or removeAllListeners()
calls after emitting and before the last listener finishes execution
+will not remove them fromemit()
in progress. Subsequent events behave as expected.
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
+
+Because listeners are managed using an internal array, calling this will
+change the position indices of any listener registered after the listener
+being removed. This will not impact the order in which listeners are called,
+but it means that any copies of the listener array as returned by
+the emitter.listeners()
method will need to be recreated.
When a single function has been added as a handler multiple times for a single
+event (as in the example below), removeListener()
will remove the most
+recently added instance. In the example the once('ping')
listener is removed:
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]v0.1.26
+Alias for emitter.removeListener()
.
Rest
...args: any[]v10.0.0
+Removes all listeners, or those of the specified eventName
.
It is bad practice to remove listeners added elsewhere in the code,
+particularly when the EventEmitter
instance was created by some other
+component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter
, so that calls can be chained.
Optional
event: string | symbolv0.1.26
+By default EventEmitter
s will print a warning if more than 10
listeners are
+added for a particular event. This is a useful default that helps finding
+memory leaks. The emitter.setMaxListeners()
method allows the limit to be
+modified for this specific EventEmitter
instance. The value can be set toInfinity
(or 0
) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter
, so that calls can be chained.
v0.3.5
+Returns the current max listener value for the EventEmitter
which is either
+set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
v1.0.0
+Returns a copy of the array of listeners for the event named eventName
.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
+
+v0.1.26
+Returns a copy of the array of listeners for the event named eventName
,
+including any wrappers (such as those created by .once()
).
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
+
+v9.4.0
+Synchronously calls each of the listeners registered for the event namedeventName
, in the order they were registered, passing the supplied arguments
+to each.
Returns true
if the event had listeners, false
otherwise.
const EventEmitter = require('events');
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
+
+Rest
...args: AnyRestv0.1.26
+Returns the number of listeners listening to the event named eventName
.
If listener
is provided, it will return how many times the listener
+is found in the list of the listeners of the event.
The name of the event being listened for
+Optional
listener: FunctionThe event handler function
+v3.2.0
+Adds the listener
function to the beginning of the listeners array for the
+event named eventName
. No checks are made to see if the listener
has
+already been added. Multiple calls passing the same combination of eventName
and listener
will result in the listener
being added, and called, multiple
+times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
The name of the event.
+The callback function
+Rest
...args: any[]v6.0.0
+Adds a one-timelistener
function for the event named eventName
to the beginning of the listeners array. The next time eventName
is triggered, this
+listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
The name of the event.
+The callback function
+Rest
...args: any[]v6.0.0
+Returns an array listing the events for which the emitter has registered
+listeners. The values in the array are strings or Symbol
s.
const EventEmitter = require('events');
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
+
+v6.0.0
+Generated using TypeDoc
The EventEmitter
class is defined and exposed by the events
module:
const EventEmitter = require('events');
+
+All EventEmitter
s emit the event 'newListener'
when new listeners are
+added and 'removeListener'
when existing listeners are removed.
It supports the following option:
+v0.1.26
+Optional
options: EventEmitterOptionsStatic
Readonly
errorThis symbol shall be used to install a listener for only monitoring 'error'
+events. Listeners installed using this symbol are called before the regular
+'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
+'error'
event is emitted, therefore the process will still crash if no
+regular 'error'
listener is installed.
Static
Readonly
captureStatic
captureSets or gets the default captureRejection value for all emitters.
+Static
defaultOptional
[captureStatic
onceCreates 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 interface, which has no special'error'
event
+semantics and does not listen to the 'error'
event.
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:
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:
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!
+
+Optional
options: StaticEventEmitterOptionsv11.13.0, v10.16.0
+Optional
options: StaticEventEmitterOptionsStatic
onconst { 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:
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());
+
+The name of the event being listened for
+Optional
options: StaticEventEmitterOptionsthat iterates eventName
events emitted by the emitter
v13.6.0, v12.16.0
+Static
listenerA class method that returns the number of listeners for the given eventName
registered on the given emitter
.
const { EventEmitter, listenerCount } = require('events');
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
+
+The emitter to query
+The event name
+v0.9.12
+Since v3.2.0 - Use listenerCount
instead.
Static
getReturns 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.
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]
}
+
+v15.2.0, v14.17.0
+Static
getReturns the currently set max amount of listeners.
+For EventEmitter
s this behaves exactly the same as calling .getMaxListeners
on
+the emitter.
For EventTarget
s this is the only way to get the max event listeners for the
+event target. If the number of event handlers on a single EventTarget exceeds
+the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
+
+v18.17.0
+Static
setconst {
setMaxListeners,
EventEmitter
} = require('events');
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
+
+Optional
n: numberA non-negative number. The maximum number of listeners per EventTarget
event.
Rest
...eventTargets: (EventEmitter<DefaultEventMap> | _DOMEventTarget)[]v15.4.0
+Static
addExperimental
Listens once to the abort
event on the provided signal
.
Listening to the abort
event on abort signals is unsafe and may
+lead to resource leaks since another third party with the signal can
+call e.stopImmediatePropagation()
. Unfortunately Node.js cannot change
+this since it would violate the web standard. Additionally, the original
+API makes it easy to forget to remove listeners.
This API allows safely using AbortSignal
s in Node.js APIs by solving these
+two issues by listening to the event such that stopImmediatePropagation
does
+not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
+import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
+
+Disposable that removes the abort
listener.
v18.18.0
+Alias for emitter.on(eventName, listener)
.
v0.1.26
+Adds the listener
function to the end of the listeners array for the
+event named eventName
. No checks are made to see if the listener
has
+already been added. Multiple calls passing the same combination of eventName
and listener
will result in the listener
being added, and called, multiple
+times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
By default, event listeners are invoked in the order they are added. Theemitter.prependListener()
method can be used as an alternative to add the
+event listener to the beginning of the listeners array.
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
+
+v0.1.101
+Adds a one-timelistener
function for the event named eventName
. The
+next time eventName
is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
By default, event listeners are invoked in the order they are added. Theemitter.prependOnceListener()
method can be used as an alternative to add the
+event listener to the beginning of the listeners array.
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
+
+v0.3.0
+Removes the specified listener
from the listener array for the event namedeventName
.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
+
+removeListener()
will remove, at most, one instance of a listener from the
+listener array. If any single listener has been added multiple times to the
+listener array for the specified eventName
, then removeListener()
must be
+called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
+time of emitting are called in order. This implies that anyremoveListener()
or removeAllListeners()
calls after emitting and before the last listener finishes execution
+will not remove them fromemit()
in progress. Subsequent events behave as expected.
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
+
+Because listeners are managed using an internal array, calling this will
+change the position indices of any listener registered after the listener
+being removed. This will not impact the order in which listeners are called,
+but it means that any copies of the listener array as returned by
+the emitter.listeners()
method will need to be recreated.
When a single function has been added as a handler multiple times for a single
+event (as in the example below), removeListener()
will remove the most
+recently added instance. In the example the once('ping')
listener is removed:
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
v0.1.26
+Alias for emitter.removeListener()
.
v10.0.0
+Removes all listeners, or those of the specified eventName
.
It is bad practice to remove listeners added elsewhere in the code,
+particularly when the EventEmitter
instance was created by some other
+component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter
, so that calls can be chained.
v0.1.26
+By default EventEmitter
s will print a warning if more than 10
listeners are
+added for a particular event. This is a useful default that helps finding
+memory leaks. The emitter.setMaxListeners()
method allows the limit to be
+modified for this specific EventEmitter
instance. The value can be set toInfinity
(or 0
) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter
, so that calls can be chained.
v0.3.5
+Returns the current max listener value for the EventEmitter
which is either
+set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
v1.0.0
+Returns a copy of the array of listeners for the event named eventName
.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
+
+v0.1.26
+Returns a copy of the array of listeners for the event named eventName
,
+including any wrappers (such as those created by .once()
).
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
+
+v9.4.0
+Synchronously calls each of the listeners registered for the event namedeventName
, in the order they were registered, passing the supplied arguments
+to each.
Returns true
if the event had listeners, false
otherwise.
const EventEmitter = require('events');
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
+
+v0.1.26
+Returns the number of listeners listening to the event named eventName
.
If listener
is provided, it will return how many times the listener
+is found in the list of the listeners of the event.
v3.2.0
+Adds the listener
function to the beginning of the listeners array for the
+event named eventName
. No checks are made to see if the listener
has
+already been added. Multiple calls passing the same combination of eventName
and listener
will result in the listener
being added, and called, multiple
+times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
v6.0.0
+Adds a one-timelistener
function for the event named eventName
to the beginning of the listeners array. The next time eventName
is triggered, this
+listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
v6.0.0
+Returns an array listing the events for which the emitter has registered
+listeners. The values in the array are strings or Symbol
s.
const EventEmitter = require('events');
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
+
+v6.0.0
+Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
+
npm install @foxxmd/logging
import { loggerAppRolling, loggerApp } from "@foxxmd/logging";
const logger = loggerApp();
logger.info('Test');
/*
* Logs to -> console, colorized
* Logs to -> CWD/logs/app.log
*
* [2024-03-07 10:31:34.963 -0500] DEBUG: Test
* */
// or for rolling log files we need to scan logs dir before opening a file
// and need to await initial logger
const rollingLogger = await loggerAppRolling();
rollingLogger.info('Test');
/*
* Logs to -> console, colorized
* Logs to daily log file, max 10MB size -> CWD/logs/app.1.log
*
* [2024-03-07 10:31:34.963 -0500] DEBUG: Test
* */
diff --git a/interfaces/factory._internal_.Colorette.html b/interfaces/factory._internal_.Colorette.html
new file mode 100644
index 0000000..f9f7925
--- /dev/null
+++ b/interfaces/factory._internal_.Colorette.html
@@ -0,0 +1,42 @@
+Colorette | @foxxmd/logging Docs Interface Colorette
interface Colorette {
reset: Color;
bold: Color;
dim: Color;
italic: Color;
underline: Color;
inverse: Color;
hidden: Color;
strikethrough: Color;
black: Color;
red: Color;
green: Color;
yellow: Color;
blue: Color;
magenta: Color;
cyan: Color;
white: Color;
gray: Color;
bgBlack: Color;
bgRed: Color;
bgGreen: Color;
bgYellow: Color;
bgBlue: Color;
bgMagenta: Color;
bgCyan: Color;
bgWhite: Color;
blackBright: Color;
redBright: Color;
greenBright: Color;
yellowBright: Color;
blueBright: Color;
magentaBright: Color;
cyanBright: Color;
whiteBright: Color;
bgBlackBright: Color;
bgRedBright: Color;
bgGreenBright: Color;
bgYellowBright: Color;
bgBlueBright: Color;
bgMagentaBright: Color;
bgCyanBright: Color;
bgWhiteBright: Color;
} Index
Properties
reset
+bold
+dim
+italic
+underline
+inverse
+hidden
+strikethrough
+black
+red
+green
+yellow
+blue
+magenta
+cyan
+white
+gray
+bg Black
+bg Red
+bg Green
+bg Yellow
+bg Blue
+bg Magenta
+bg Cyan
+bg White
+black Bright
+red Bright
+green Bright
+yellow Bright
+blue Bright
+magenta Bright
+cyan Bright
+white Bright
+bg Black Bright
+bg Red Bright
+bg Green Bright
+bg Yellow Bright
+bg Blue Bright
+bg Magenta Bright
+bg Cyan Bright
+bg White Bright
+Properties
reset
bold
dim
italic
underline
inverse
hidden
strikethrough
black
red
green
yellow
blue
magenta
cyan
white
gray
bg Black
bg Red
bg Green
bg Yellow
bg Blue
bg Magenta
bg Cyan
bg White
black Bright
red Bright
green Bright
yellow Bright
blue Bright
magenta Bright
cyan Bright
white Bright
bg Black Bright
bg Red Bright
bg Green Bright
bg Yellow Bright
bg Blue Bright
bg Magenta Bright
bg Cyan Bright
bg White Bright
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/factory._internal_.DestinationStream.html b/interfaces/factory._internal_.DestinationStream.html
new file mode 100644
index 0000000..3d96c7b
--- /dev/null
+++ b/interfaces/factory._internal_.DestinationStream.html
@@ -0,0 +1,2 @@
+DestinationStream | @foxxmd/logging Docs Interface DestinationStream
Hierarchy (view full)
- DestinationStream
- DestinationStream
Index
Methods
write
+Methods
write
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/factory._internal_.PrettyOptions_.html b/interfaces/factory._internal_.PrettyOptions_.html
new file mode 100644
index 0000000..23503c4
--- /dev/null
+++ b/interfaces/factory._internal_.PrettyOptions_.html
@@ -0,0 +1,120 @@
+PrettyOptions_ | @foxxmd/logging Docs Interface PrettyOptions_
interface PrettyOptions_ {
hideObject?: boolean;
translateTime?: string | boolean;
levelFirst?: boolean;
levelKey?: string;
levelLabel?: string;
messageKey?: string;
singleLine?: boolean;
timestampKey?: string;
minimumLevel?: Level;
messageFormat?: string | false | MessageFormatFunc;
colorize?: boolean;
colorizeObjects?: boolean;
crlf?: boolean;
errorLikeObjectKeys?: string[];
errorProps?: string;
ignore?: string;
include?: string;
sync?: boolean;
destination?: string | number | DestinationStream | WritableStream;
append?: boolean;
mkdir?: boolean;
customPrettifiers?: Record<string, Prettifier<object>> & {
level?: Prettifier<LevelPrettifierExtras>;
};
customLevels?: string | object;
customColors?: string | object;
} Index
Properties
hide Object?
+translate Time?
+level First?
+level Key?
+level Label?
+message Key?
+single Line?
+timestamp Key?
+minimum Level?
+message Format?
+colorize?
+colorize Objects?
+crlf?
+error Like Object Keys?
+error Props?
+ignore?
+include?
+sync?
+destination?
+append?
+mkdir?
+custom Prettifiers?
+custom Levels?
+custom Colors?
+Properties
Optional
hide Object
hide Object?: booleanHide objects from output (but not error object).
+Default
false
+
+Optional
translate Time
translate Time?: string | booleanTranslate the epoch time value into a human readable date and time string. This flag also can set the format
+string to apply when translating the date to human readable format. For a list of available pattern letters
+see the documentation.
+
+- The default format is
yyyy-mm-dd HH:MM:ss.l o
in UTC.
+- Requires a
SYS:
prefix to translate time to the local system's timezone. Use the shortcut SYS:standard
+to translate time to yyyy-mm-dd HH:MM:ss.l o
in system timezone.
+
+Default
false
+
+Optional
level First
level First?: booleanIf set to true, it will print the name of the log level as the first field in the log line.
+Default
false
+
+Optional
level Key
level Key?: stringDefine the key that contains the level of the log.
+Default
"level"
+
+Optional
level Label
level Label?: stringOutput the log level using the specified label.
+Default
"levelLabel"
+
+Optional
message Key
message Key?: stringThe key in the JSON object to use as the highlighted message.
+Default
"msg"
+
+Optional
single Line
single Line?: booleanPrint each log message on a single line (errors will still be multi-line).
+Default
false
+
+Optional
timestamp Key
timestamp Key?: stringThe key in the JSON object to use for timestamp display.
+Default
"time"
+
+Optional
minimum Level
The minimum log level to include in the output.
+Default
"trace"
+
+Optional
message Format
Format output of message, e.g. {level} - {pid} will output message: INFO - 1123
+Default
false
+
+Example
{
messageFormat: (log, messageKey) => {
const message = log[messageKey];
if (log.requestId) return `[${log.requestId}] ${message}`;
return message;
}
}
+
+Optional
colorize
colorize?: booleanIf set to true, will add color information to the formatted output message.
+Default
false
+
+Optional
colorize Objects
colorize Objects?: booleanIf set to false while colorize
is true
, will output JSON objects without color.
+Default
true
+
+Optional
crlf
crlf?: booleanAppends carriage return and line feed, instead of just a line feed, to the formatted log line.
+Default
false
+
+Optional
error Like Object Keys
error Like Object Keys?: string[]Define the log keys that are associated with error like objects.
+Default
["err", "error"]
+
+Optional
error Props
error Props?: stringWhen formatting an error object, display this list of properties.
+ The list should be a comma separated list of properties.
+Default
""
+
+Optional
ignore
ignore?: stringIgnore one or several keys.
+Will be overridden by the option include if include is presented.
+Example
"time,hostname"
+
+Optional
include
include?: stringInclude one or several keys.
+Example
"time,level"
+
+Optional
sync
sync?: booleanMakes messaging synchronous.
+Default
false
+
+Optional
destination
The file, file descriptor, or stream to write to. Defaults to 1 (stdout).
+Default
1
+
+Optional
append
append?: booleanOpens the file with the 'a' flag.
+Default
true
+
+Optional
mkdir
mkdir?: booleanEnsure directory for destination file exists.
+Default
false
+
+Optional
custom Prettifiers
custom Prettifiers?: Record<string, Prettifier<object>> & {
level?: Prettifier<LevelPrettifierExtras>;
}Provides the ability to add a custom prettify function for specific log properties.
+customPrettifiers
is an object, where keys are log properties that will be prettified
+and value is the prettify function itself.
+For example, if a log line contains a query property, you can specify a prettifier for it:
+Type declaration
Optional
level?: Prettifier<LevelPrettifierExtras>
Default
{}
+
+Example
{
customPrettifiers: {
query: prettifyQuery
}
}
//...
const prettifyQuery = value => {
// do some prettify magic
}
+
+Optional
custom Levels
custom Levels?: string | objectChange the level names and values to an user custom preset.
+Can be a CSV string in 'level_name:level_value' format or an object.
+Example
( CSV ) customLevels: 'info:10,some_level:40'
+
+Example
( Object ) customLevels: { info: 10, some_level: 40 }
+
+Optional
custom Colors
custom Colors?: string | objectChange the level colors to an user custom preset.
+Can be a CSV string in 'level_name:color_value' format or an object.
+Also supports 'default' as level_name for fallback color.
+Example
( CSV ) customColors: 'info:white,some_level:red'
+
+Example
( Object ) customColors: { info: 'white', some_level: 'red' }
+
+Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/factory._internal_.WritableStream.html b/interfaces/factory._internal_.WritableStream.html
new file mode 100644
index 0000000..6c2261a
--- /dev/null
+++ b/interfaces/factory._internal_.WritableStream.html
@@ -0,0 +1,133 @@
+WritableStream | @foxxmd/logging Docs Interface WritableStream
interface WritableStream {
[captureRejectionSymbol]?<K>(error, event, ...args): void;
addListener<K>(eventName, listener): this;
on<K>(eventName, listener): this;
once<K>(eventName, listener): this;
removeListener<K>(eventName, listener): this;
off<K>(eventName, listener): this;
removeAllListeners(event?): this;
setMaxListeners(n): this;
getMaxListeners(): number;
listeners<K>(eventName): Function[];
rawListeners<K>(eventName): Function[];
emit<K>(eventName, ...args): boolean;
listenerCount<K>(eventName, listener?): number;
prependListener<K>(eventName, listener): this;
prependOnceListener<K>(eventName, listener): this;
eventNames(): (string | symbol)[];
writable: boolean;
write(buffer, cb?): boolean;
write(str, encoding?, cb?): boolean;
end(cb?): this;
end(data, cb?): this;
end(str, encoding?, cb?): this;
}Hierarchy
- EventEmitter
- WritableStream
Index
Properties
writable
+Methods
Properties
writable
writable: booleanMethods
Optional
[capture Rejection Symbol]
add Listener
- add
Listener<K>(eventName, listener): this Alias for emitter.on(eventName, listener)
.
+Type Parameters
Parameters
- eventName: string | symbol
- listener: ((...args) => void)
- (...args): void
Parameters
Rest
...args: any[]
Returns void
Returns this
Since
v0.1.26
+
on
- on<K>(eventName, listener): this
Adds the listener
function to the end of the listeners array for the
+event named eventName
. No checks are made to see if the listener
has
+already been added. Multiple calls passing the same combination of eventName
and listener
will result in the listener
being added, and called, multiple
+times.
+server.on('connection', (stream) => {
console.log('someone connected!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
+By default, event listeners are invoked in the order they are added. Theemitter.prependListener()
method can be used as an alternative to add the
+event listener to the beginning of the listeners array.
+const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
+
+Type Parameters
Parameters
- eventName: string | symbol
The name of the event.
+ - listener: ((...args) => void)
The callback function
+- (...args): void
Parameters
Rest
...args: any[]
Returns void
Returns this
Since
v0.1.101
+
once
- once<K>(eventName, listener): this
Adds a one-timelistener
function for the event named eventName
. The
+next time eventName
is triggered, this listener is removed and then invoked.
+server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
+By default, event listeners are invoked in the order they are added. Theemitter.prependOnceListener()
method can be used as an alternative to add the
+event listener to the beginning of the listeners array.
+const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
+
+Type Parameters
Parameters
- eventName: string | symbol
The name of the event.
+ - listener: ((...args) => void)
The callback function
+- (...args): void
Parameters
Rest
...args: any[]
Returns void
Returns this
Since
v0.3.0
+
remove Listener
- remove
Listener<K>(eventName, listener): this Removes the specified listener
from the listener array for the event namedeventName
.
+const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
+
+removeListener()
will remove, at most, one instance of a listener from the
+listener array. If any single listener has been added multiple times to the
+listener array for the specified eventName
, then removeListener()
must be
+called multiple times to remove each instance.
+Once an event is emitted, all listeners attached to it at the
+time of emitting are called in order. This implies that anyremoveListener()
or removeAllListeners()
calls after emitting and before the last listener finishes execution
+will not remove them fromemit()
in progress. Subsequent events behave as expected.
+const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
+
+Because listeners are managed using an internal array, calling this will
+change the position indices of any listener registered after the listener
+being removed. This will not impact the order in which listeners are called,
+but it means that any copies of the listener array as returned by
+the emitter.listeners()
method will need to be recreated.
+When a single function has been added as a handler multiple times for a single
+event (as in the example below), removeListener()
will remove the most
+recently added instance. In the example the once('ping')
listener is removed:
+const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Type Parameters
Parameters
- eventName: string | symbol
- listener: ((...args) => void)
- (...args): void
Parameters
Rest
...args: any[]
Returns void
Returns this
Since
v0.1.26
+
off
- off<K>(eventName, listener): this
Alias for emitter.removeListener()
.
+Type Parameters
Parameters
- eventName: string | symbol
- listener: ((...args) => void)
- (...args): void
Parameters
Rest
...args: any[]
Returns void
Returns this
Since
v10.0.0
+
remove All Listeners
- remove
All Listeners(event?): this Removes all listeners, or those of the specified eventName
.
+It is bad practice to remove listeners added elsewhere in the code,
+particularly when the EventEmitter
instance was created by some other
+component or module (e.g. sockets or file streams).
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Parameters
Optional
event: string | symbol
Returns this
Since
v0.1.26
+
set Max Listeners
- set
Max Listeners(n): this By default EventEmitter
s will print a warning if more than 10
listeners are
+added for a particular event. This is a useful default that helps finding
+memory leaks. The emitter.setMaxListeners()
method allows the limit to be
+modified for this specific EventEmitter
instance. The value can be set toInfinity
(or 0
) to indicate an unlimited number of listeners.
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Parameters
- n: number
Returns this
Since
v0.3.5
+
get Max Listeners
listeners
- listeners<K>(eventName): Function[]
Returns a copy of the array of listeners for the event named eventName
.
+server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
+
+Type Parameters
Parameters
- eventName: string | symbol
Returns Function[]
Since
v0.1.26
+
raw Listeners
- raw
Listeners<K>(eventName): Function[] Returns a copy of the array of listeners for the event named eventName
,
+including any wrappers (such as those created by .once()
).
+const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
+
+Type Parameters
Parameters
- eventName: string | symbol
Returns Function[]
Since
v9.4.0
+
emit
- emit<K>(eventName, ...args): boolean
Synchronously calls each of the listeners registered for the event namedeventName
, in the order they were registered, passing the supplied arguments
+to each.
+Returns true
if the event had listeners, false
otherwise.
+const EventEmitter = require('events');
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
+
+Type Parameters
Parameters
- eventName: string | symbol
Rest
...args: AnyRest
Returns boolean
Since
v0.1.26
+
listener Count
- listener
Count<K>(eventName, listener?): number Returns the number of listeners listening to the event named eventName
.
+If listener
is provided, it will return how many times the listener
+is found in the list of the listeners of the event.
+Type Parameters
Parameters
- eventName: string | symbol
The name of the event being listened for
+ Optional
listener: FunctionThe event handler function
+
Returns number
Since
v3.2.0
+
prepend Listener
- prepend
Listener<K>(eventName, listener): this Adds the listener
function to the beginning of the listeners array for the
+event named eventName
. No checks are made to see if the listener
has
+already been added. Multiple calls passing the same combination of eventName
and listener
will result in the listener
being added, and called, multiple
+times.
+server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Type Parameters
Parameters
- eventName: string | symbol
The name of the event.
+ - listener: ((...args) => void)
The callback function
+- (...args): void
Parameters
Rest
...args: any[]
Returns void
Returns this
Since
v6.0.0
+
prepend Once Listener
- prepend
Once Listener<K>(eventName, listener): this Adds a one-timelistener
function for the event named eventName
to the beginning of the listeners array. The next time eventName
is triggered, this
+listener is removed, and then invoked.
+server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Type Parameters
Parameters
- eventName: string | symbol
The name of the event.
+ - listener: ((...args) => void)
The callback function
+- (...args): void
Parameters
Rest
...args: any[]
Returns void
Returns this
Since
v6.0.0
+
event Names
- event
Names(): (string | symbol)[] Returns an array listing the events for which the emitter has registered
+listeners. The values in the array are strings or Symbol
s.
+const EventEmitter = require('events');
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
+
+Returns (string | symbol)[]
Since
v6.0.0
+
write
- write(buffer, cb?): boolean
Parameters
- buffer: string | Uint8Array
Optional
cb: ((err?) => void)- (err?): void
Parameters
Optional
err: Error
Returns void
Returns boolean
- write(str, encoding?, cb?): boolean
Parameters
- str: string
Optional
encoding: BufferEncodingOptional
cb: ((err?) => void)- (err?): void
Parameters
Optional
err: Error
Returns void
Returns boolean
end
- end(cb?): this
Parameters
Optional
cb: (() => void)- (): void
Returns void
Returns this
- end(data, cb?): this
Parameters
- data: string | Uint8Array
Optional
cb: (() => void)- (): void
Returns void
Returns this
- end(str, encoding?, cb?): this
Parameters
- str: string
Optional
encoding: BufferEncodingOptional
cb: (() => void)- (): void
Returns void
Returns this
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index.LogOptions.html b/interfaces/index.LogOptions.html
index 9ec9a71..2d02231 100644
--- a/interfaces/index.LogOptions.html
+++ b/interfaces/index.LogOptions.html
@@ -1,4 +1,4 @@
-LogOptions | @foxxmd/logging Docs Interface LogOptions
interface LogOptions {
level?: "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug";
file?: false | "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug";
filePath?: string | (() => string);
console?: "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug";
} Index
Properties
level?
+LogOptions | @foxxmd/logging Docs Interface LogOptions
interface LogOptions {
level?: "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug";
file?: false | "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug";
filePath?: string | (() => string);
console?: "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug";
} Index
Properties
level?
file?
file Path?
console?
@@ -6,11 +6,11 @@
Defaults to env LOG_LEVEL
or info
if not specified.
Default
'info'
-Optional
file
file?: false | "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug"Specify the minimum log level to output to rotating files. If false
no log files will be created.
-Optional
file Path
file Path?: string | (() => string)The full path and filename to use for log files
+Optional
file
file?: false | "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug"Specify the minimum log level to output to rotating files. If false
no log files will be created.
+Optional
file Path
file Path?: string | (() => string)The full path and filename to use for log files
If using rolling files the filename will be appended with .N
(a number) BEFORE the extension based on rolling status
May also be specified using env LOG_PATH or a function that returns a string
-Type declaration
- (): string
Returns string
Default
'CWD/logs/app.log
+
Type declaration
- (): string
Returns string
Default
'CWD/logs/app.log'
-Optional
console
console?: "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug"Specify the minimum log level streamed to the console (or docker container)
-Generated using TypeDoc
\ No newline at end of file
+Optional
console
console?: "silent" | "fatal" | "error" | "warn" | "info" | "log" | "verbose" | "debug"Specify the minimum log level streamed to the console (or docker container)
+Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.AsyncIterableIterator.html b/interfaces/index._internal_.AsyncIterableIterator.html
new file mode 100644
index 0000000..892bd38
--- /dev/null
+++ b/interfaces/index._internal_.AsyncIterableIterator.html
@@ -0,0 +1,5 @@
+AsyncIterableIterator | @foxxmd/logging Docs Interface AsyncIterableIterator<T>
interface AsyncIterableIterator<T> {
next(...args): Promise<IteratorResult<T, any>>;
return?(value?): Promise<IteratorResult<T, any>>;
throw?(e?): Promise<IteratorResult<T, any>>;
[asyncIterator](): AsyncIterableIterator<T>;
} Type Parameters
Hierarchy (view full)
- AsyncIterator<T>
- AsyncIterableIterator
Index
Methods
Methods
next
- next(...args): Promise<IteratorResult<T, any>>
Parameters
Rest
...args: [] | [undefined]
Returns Promise<IteratorResult<T, any>>
Optional
return
- return(value?): Promise<IteratorResult<T, any>>
Parameters
Optional
value: any
Returns Promise<IteratorResult<T, any>>
Optional
throw
- throw(e?): Promise<IteratorResult<T, any>>
Parameters
Optional
e: any
Returns Promise<IteratorResult<T, any>>
[async Iterator]
- [async
Iterator](): AsyncIterableIterator<T> Returns AsyncIterableIterator<T>
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.AsyncIterator.html b/interfaces/index._internal_.AsyncIterator.html
new file mode 100644
index 0000000..127670d
--- /dev/null
+++ b/interfaces/index._internal_.AsyncIterator.html
@@ -0,0 +1,4 @@
+AsyncIterator | @foxxmd/logging Docs Interface AsyncIterator<T, TReturn, TNext>
interface AsyncIterator<T, TReturn, TNext> {
next(...args): Promise<IteratorResult<T, TReturn>>;
return?(value?): Promise<IteratorResult<T, TReturn>>;
throw?(e?): Promise<IteratorResult<T, TReturn>>;
} Type Parameters
Hierarchy (view full)
- AsyncIterator
Methods
next
- next(...args): Promise<IteratorResult<T, TReturn>>
Parameters
Rest
...args: [] | [TNext]
Returns Promise<IteratorResult<T, TReturn>>
Optional
return
- return(value?): Promise<IteratorResult<T, TReturn>>
Parameters
Optional
value: TReturn | PromiseLike<TReturn>
Returns Promise<IteratorResult<T, TReturn>>
Optional
throw
- throw(e?): Promise<IteratorResult<T, TReturn>>
Parameters
Optional
e: any
Returns Promise<IteratorResult<T, TReturn>>
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.AsyncResourceOptions.html b/interfaces/index._internal_.AsyncResourceOptions.html
new file mode 100644
index 0000000..30f985d
--- /dev/null
+++ b/interfaces/index._internal_.AsyncResourceOptions.html
@@ -0,0 +1,12 @@
+AsyncResourceOptions | @foxxmd/logging Docs Interface AsyncResourceOptions
Hierarchy (view full)
- AsyncResourceOptions
Index
Properties
Properties
Optional
trigger Async Id
trigger Async Id?: numberThe ID of the execution context that created this async event.
+Default
executionAsyncId()
+
+Optional
require Manual Destroy
require Manual Destroy?: booleanDisables automatic emitDestroy
when the object is garbage collected.
+This usually does not need to be set (even if emitDestroy
is called
+manually), unless the resource's asyncId
is retrieved and the
+sensitive API's emitDestroy
is called with it.
+Default
false
+
+Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.BaseLogger.html b/interfaces/index._internal_.BaseLogger.html
new file mode 100644
index 0000000..6698a03
--- /dev/null
+++ b/interfaces/index._internal_.BaseLogger.html
@@ -0,0 +1,58 @@
+BaseLogger | @foxxmd/logging Docs Interface BaseLogger
interface BaseLogger {
level: LevelWithSilentOrString;
fatal: LogFn;
error: LogFn;
warn: LogFn;
info: LogFn;
debug: LogFn;
trace: LogFn;
silent: LogFn;
}Properties
level
Set this property to the desired logging level. In order of priority, available levels are:
+
+- 'fatal'
+- 'error'
+- 'warn'
+- 'info'
+- 'debug'
+- 'trace'
+
+The logging level is a minimum level. For instance if logger.level
is 'info'
then all 'fatal'
, 'error'
, 'warn'
,
+and 'info'
logs will be enabled.
+You can pass 'silent'
to disable logging.
+fatal
Log at 'fatal'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line.
+If more args follows msg
, these will be used to format msg
using util.format
.
+Type Param: T:
the interface of the object being serialized. Default is object.
+Param: obj:
object to be serialized
+Param: msg:
the log message to write
+Param: ...args:
format string values when msg
is a format string
+error
Log at 'error'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line.
+If more args follows msg
, these will be used to format msg
using util.format
.
+Type Param: T:
the interface of the object being serialized. Default is object.
+Param: obj:
object to be serialized
+Param: msg:
the log message to write
+Param: ...args:
format string values when msg
is a format string
+warn
Log at 'warn'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line.
+If more args follows msg
, these will be used to format msg
using util.format
.
+Type Param: T:
the interface of the object being serialized. Default is object.
+Param: obj:
object to be serialized
+Param: msg:
the log message to write
+Param: ...args:
format string values when msg
is a format string
+info
Log at 'info'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line.
+If more args follows msg
, these will be used to format msg
using util.format
.
+Type Param: T:
the interface of the object being serialized. Default is object.
+Param: obj:
object to be serialized
+Param: msg:
the log message to write
+Param: ...args:
format string values when msg
is a format string
+debug
Log at 'debug'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line.
+If more args follows msg
, these will be used to format msg
using util.format
.
+Type Param: T:
the interface of the object being serialized. Default is object.
+Param: obj:
object to be serialized
+Param: msg:
the log message to write
+Param: ...args:
format string values when msg
is a format string
+trace
Log at 'trace'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line.
+If more args follows msg
, these will be used to format msg
using util.format
.
+Type Param: T:
the interface of the object being serialized. Default is object.
+Param: obj:
object to be serialized
+Param: msg:
the log message to write
+Param: ...args:
format string values when msg
is a format string
+silent
Noop function.
+Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.CallSite.html b/interfaces/index._internal_.CallSite.html
new file mode 100644
index 0000000..cad8b1a
--- /dev/null
+++ b/interfaces/index._internal_.CallSite.html
@@ -0,0 +1,34 @@
+CallSite | @foxxmd/logging Docs Interface CallSite
interface CallSite {
getThis(): unknown;
getTypeName(): string;
getFunction(): Function;
getFunctionName(): string;
getMethodName(): string;
getFileName(): string;
getLineNumber(): number;
getColumnNumber(): number;
getEvalOrigin(): string;
isToplevel(): boolean;
isEval(): boolean;
isNative(): boolean;
isConstructor(): boolean;
} Index
Methods
get This
get Type Name
get Function
get Function Name
get Method Name
get File Name
get Line Number
get Column Number
get Eval Origin
is Toplevel
is Eval
is Native
is Constructor
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.ChildLoggerOptions-1.html b/interfaces/index._internal_.ChildLoggerOptions-1.html
new file mode 100644
index 0000000..3e06947
--- /dev/null
+++ b/interfaces/index._internal_.ChildLoggerOptions-1.html
@@ -0,0 +1,7 @@
+ChildLoggerOptions | @foxxmd/logging Docs Interface ChildLoggerOptions<CustomLevels>
interface ChildLoggerOptions<CustomLevels> {
level?: LevelOrString;
serializers?: {
[key: string]: SerializerFn;
};
customLevels?: {
[level in string]: number
};
formatters?: {
level?: ((label, number) => object);
bindings?: ((bindings) => object);
log?: ((object) => object);
};
redact?: string[] | redactOptions;
msgPrefix?: string;
} Type Parameters
Hierarchy (view full)
- ChildLoggerOptions<CustomLevels>
- ChildLoggerOptions
Index
Properties
Properties
Optional
level
Optional
serializers
Type declaration
[key: string]: SerializerFn
Optional
custom Levels
custom Levels?: {
[level in string]: number
}Optional
formatters
formatters?: {
level?: ((label, number) => object);
bindings?: ((bindings) => object);
log?: ((object) => object);
}Type declaration
Optional
level?: ((label, number) => object)
- (label, number): object
Parameters
- label: string
- number: number
Returns object
Optional
bindings?: ((bindings) => object)
- (bindings): object
Parameters
- bindings: Bindings
Returns object
Optional
log?: ((object) => object)
- (object): object
Parameters
- object: object
Returns object
Optional
redact
Optional
msg Prefix
msg Prefix?: stringGenerated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.ChildLoggerOptions.html b/interfaces/index._internal_.ChildLoggerOptions.html
new file mode 100644
index 0000000..b01bc33
--- /dev/null
+++ b/interfaces/index._internal_.ChildLoggerOptions.html
@@ -0,0 +1,7 @@
+ChildLoggerOptions | @foxxmd/logging Docs Interface ChildLoggerOptions<CustomLevels>
interface ChildLoggerOptions<CustomLevels> {
level?: LevelOrString;
serializers?: {
[key: string]: SerializerFn;
};
customLevels?: {
[level in string]: number
};
formatters?: {
level?: ((label, number) => object);
bindings?: ((bindings) => object);
log?: ((object) => object);
};
redact?: string[] | redactOptions;
msgPrefix?: string;
} Type Parameters
Hierarchy (view full)
- ChildLoggerOptions
Index
Properties
Properties
Optional
level
Optional
serializers
Type declaration
[key: string]: SerializerFn
Optional
custom Levels
custom Levels?: {
[level in string]: number
}Optional
formatters
formatters?: {
level?: ((label, number) => object);
bindings?: ((bindings) => object);
log?: ((object) => object);
}Type declaration
Optional
level?: ((label, number) => object)
- (label, number): object
Parameters
- label: string
- number: number
Returns object
Optional
bindings?: ((bindings) => object)
- (bindings): object
Parameters
- bindings: Bindings
Returns object
Optional
log?: ((object) => object)
- (object): object
Parameters
- object: object
Returns object
Optional
redact
Optional
msg Prefix
msg Prefix?: stringGenerated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.DestinationStream.html b/interfaces/index._internal_.DestinationStream.html
new file mode 100644
index 0000000..c2e27c8
--- /dev/null
+++ b/interfaces/index._internal_.DestinationStream.html
@@ -0,0 +1,2 @@
+DestinationStream | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.EventEmitter-1.Abortable.html b/interfaces/index._internal_.EventEmitter-1.Abortable.html
new file mode 100644
index 0000000..33265b0
--- /dev/null
+++ b/interfaces/index._internal_.EventEmitter-1.Abortable.html
@@ -0,0 +1,3 @@
+Abortable | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.EventEmitter-1.EventEmitterAsyncResourceOptions.html b/interfaces/index._internal_.EventEmitter-1.EventEmitterAsyncResourceOptions.html
new file mode 100644
index 0000000..247a4c3
--- /dev/null
+++ b/interfaces/index._internal_.EventEmitter-1.EventEmitterAsyncResourceOptions.html
@@ -0,0 +1,19 @@
+EventEmitterAsyncResourceOptions | @foxxmd/logging Docs Interface EventEmitterAsyncResourceOptions
interface EventEmitterAsyncResourceOptions {
triggerAsyncId?: number;
requireManualDestroy?: boolean;
captureRejections?: boolean;
name?: string;
}Hierarchy (view full)
- AsyncResourceOptions
- EventEmitterOptions
- EventEmitterAsyncResourceOptions
Index
Properties
Properties
Optional
trigger Async Id
trigger Async Id?: numberThe ID of the execution context that created this async event.
+Default
executionAsyncId()
+
+Optional
require Manual Destroy
require Manual Destroy?: booleanDisables automatic emitDestroy
when the object is garbage collected.
+This usually does not need to be set (even if emitDestroy
is called
+manually), unless the resource's asyncId
is retrieved and the
+sensitive API's emitDestroy
is called with it.
+Default
false
+
+Optional
capture Rejections
capture Rejections?: booleanEnables automatic capturing of promise rejection.
+Optional
name
name?: stringThe type of async event, this is required when instantiating EventEmitterAsyncResource
+directly rather than as a child class.
+Default
new.target.name if instantiated as a child class.
+
+Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.EventEmitter-1.EventEmitterReferencingAsyncResource.html b/interfaces/index._internal_.EventEmitter-1.EventEmitterReferencingAsyncResource.html
new file mode 100644
index 0000000..7f9d6d0
--- /dev/null
+++ b/interfaces/index._internal_.EventEmitter-1.EventEmitterReferencingAsyncResource.html
@@ -0,0 +1,34 @@
+EventEmitterReferencingAsyncResource | @foxxmd/logging Docs Interface EventEmitterReferencingAsyncResource
The class AsyncResource
is designed to be extended by the embedder's async
+resources. Using this, users can easily trigger the lifetime events of their
+own resources.
+The init
hook will trigger when an AsyncResource
is instantiated.
+The following is an overview of the AsyncResource
API.
+import { AsyncResource, executionAsyncId } from 'async_hooks';
// AsyncResource() is meant to be extended. Instantiating a
// new AsyncResource() also triggers init. If triggerAsyncId is omitted then
// async_hook.executionAsyncId() is used.
const asyncResource = new AsyncResource(
type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
);
// Run a function in the execution context of the resource. This will
// * establish the context of the resource
// * trigger the AsyncHooks before callbacks
// * call the provided function `fn` with the supplied arguments
// * trigger the AsyncHooks after callbacks
// * restore the original execution context
asyncResource.runInAsyncScope(fn, thisArg, ...args);
// Call AsyncHooks destroy callbacks.
asyncResource.emitDestroy();
// Return the unique ID assigned to the AsyncResource instance.
asyncResource.asyncId();
// Return the trigger ID for the AsyncResource instance.
asyncResource.triggerAsyncId();
+
+ interface EventEmitterReferencingAsyncResource {
bind<Func>(fn): Func & {
asyncResource: AsyncResource;
};
runInAsyncScope<This, Result>(fn, thisArg?, ...args): Result;
emitDestroy(): this;
asyncId(): number;
triggerAsyncId(): number;
eventEmitter: EventEmitterAsyncResource;
}Hierarchy (view full)
- AsyncResource
- EventEmitterReferencingAsyncResource
Index
Properties
Methods
Properties
Readonly
event Emitter
Methods
bind
- bind<Func>(fn): Func & {
asyncResource: AsyncResource;
} Binds the given function to execute to this AsyncResource
's scope.
+The returned function will have an asyncResource
property referencing
+the AsyncResource
to which the function is bound.
+Type Parameters
Parameters
- fn: Func
The function to bind to the current AsyncResource
.
+
Returns Func & {
asyncResource: AsyncResource;
}
Since
v14.8.0, v12.19.0
+
run In Async Scope
- run
In Async Scope<This, Result>(fn, thisArg?, ...args): Result Call the provided function with the provided arguments in the execution context
+of the async resource. This will establish the context, trigger the AsyncHooks
+before callbacks, call the function, trigger the AsyncHooks after callbacks, and
+then restore the original execution context.
+Type Parameters
Parameters
Returns Result
Since
v9.6.0
+
emit Destroy
- emit
Destroy(): this Call all destroy
hooks. This should only ever be called once. An error will
+be thrown if it is called more than once. This must be manually called. If
+the resource is left to be collected by the GC then the destroy
hooks will
+never be called.
+Returns this
A reference to asyncResource
.
+
async Id
trigger Async Id
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.EventEmitterOptions.html b/interfaces/index._internal_.EventEmitterOptions.html
new file mode 100644
index 0000000..b207c49
--- /dev/null
+++ b/interfaces/index._internal_.EventEmitterOptions.html
@@ -0,0 +1,3 @@
+EventEmitterOptions | @foxxmd/logging Docs Interface EventEmitterOptions
Hierarchy (view full)
- EventEmitterOptions
Index
Properties
Properties
Optional
capture Rejections
capture Rejections?: booleanEnables automatic capturing of promise rejection.
+Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.IteratorReturnResult.html b/interfaces/index._internal_.IteratorReturnResult.html
new file mode 100644
index 0000000..70b34f7
--- /dev/null
+++ b/interfaces/index._internal_.IteratorReturnResult.html
@@ -0,0 +1,3 @@
+IteratorReturnResult | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.IteratorYieldResult.html b/interfaces/index._internal_.IteratorYieldResult.html
new file mode 100644
index 0000000..24cc1da
--- /dev/null
+++ b/interfaces/index._internal_.IteratorYieldResult.html
@@ -0,0 +1,3 @@
+IteratorYieldResult | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.LevelMapping.html b/interfaces/index._internal_.LevelMapping.html
new file mode 100644
index 0000000..837127e
--- /dev/null
+++ b/interfaces/index._internal_.LevelMapping.html
@@ -0,0 +1,5 @@
+LevelMapping | @foxxmd/logging Docs Interface LevelMapping
interface LevelMapping {
values: {
[level: string]: number;
};
labels: {
[level: number]: string;
};
}Properties
values
values: {
[level: string]: number;
}Returns the mappings of level names to their respective internal number representation.
+Type declaration
[level: string]: number
labels
labels: {
[level: number]: string;
}Returns the mappings of level internal level numbers to their string representations.
+Type declaration
[level: number]: string
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.LogFn-1.html b/interfaces/index._internal_.LogFn-1.html
new file mode 100644
index 0000000..cec7c34
--- /dev/null
+++ b/interfaces/index._internal_.LogFn-1.html
@@ -0,0 +1 @@
+LogFn | @foxxmd/logging Docs Interface LogFn
interface LogFn {
<T>(obj, msg?, ...args): void;
(obj, msg?, ...args): void;
(msg, ...args): void;
}Hierarchy (view full)
- LogFn
- LogFn
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.LogFn.html b/interfaces/index._internal_.LogFn.html
new file mode 100644
index 0000000..8786494
--- /dev/null
+++ b/interfaces/index._internal_.LogFn.html
@@ -0,0 +1 @@
+LogFn | @foxxmd/logging Docs Interface LogFn
interface LogFn {
<T>(obj, msg?, ...args): void;
(obj, msg?, ...args): void;
(msg, ...args): void;
}Hierarchy (view full)
- LogFn
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.LoggerExtras.html b/interfaces/index._internal_.LoggerExtras.html
new file mode 100644
index 0000000..02b2717
--- /dev/null
+++ b/interfaces/index._internal_.LoggerExtras.html
@@ -0,0 +1,155 @@
+LoggerExtras | @foxxmd/logging Docs Interface LoggerExtras<CustomLevels>
The EventEmitter
class is defined and exposed by the events
module:
+const EventEmitter = require('events');
+
+All EventEmitter
s emit the event 'newListener'
when new listeners are
+added and 'removeListener'
when existing listeners are removed.
+It supports the following option:
+Since
v0.1.26
+ interface LoggerExtras<CustomLevels> {
[captureRejectionSymbol]?<K>(error, event, ...args): void;
off<K>(eventName, listener): this;
removeAllListeners(event?): this;
setMaxListeners(n): this;
getMaxListeners(): number;
listeners<K>(eventName): Function[];
rawListeners<K>(eventName): Function[];
emit<K>(eventName, ...args): boolean;
listenerCount<K>(eventName, listener?): number;
eventNames(): (string | symbol)[];
version: string;
levels: LevelMapping;
useLevelLabels: boolean;
customLevels: {
[level in string]: number
};
useOnlyCustomLevels: boolean;
levelVal: number;
child<ChildCustomLevels>(bindings, options?): Logger<CustomLevels | ChildCustomLevels>;
onChild: OnChildCallback<CustomLevels>;
on(event, listener): this;
addListener(event, listener): this;
once(event, listener): this;
prependListener(event, listener): this;
prependOnceListener(event, listener): this;
removeListener(event, listener): this;
isLevelEnabled(level): boolean;
bindings(): Bindings;
setBindings(bindings): void;
flush(cb?): void;
} Type Parameters
Hierarchy (view full)
- EventEmitter
- LoggerExtras
Index
Properties
Methods
Properties
Readonly
version
version: stringExposes the Pino package version. Also available on the exported pino function.
+levels
use Level Labels
use Level Labels: booleanOutputs the level as a string instead of integer.
+custom Levels
custom Levels: {
[level in string]: number
}Define additional logging levels.
+use Only Custom Levels
use Only Custom Levels: booleanUse only defined customLevels
and omit Pino's levels.
+level Val
level Val: numberReturns the integer value for the logger instance's logging level.
+on Child
This can be used to modify the callback function on creation of a new child.
+Methods
Optional
[capture Rejection Symbol]
off
- off<K>(eventName, listener): this
Alias for emitter.removeListener()
.
+Type Parameters
Parameters
- eventName: string | symbol
- listener: ((...args) => void)
- (...args): void
Parameters
Rest
...args: any[]
Returns void
Returns this
Since
v10.0.0
+
remove All Listeners
- remove
All Listeners(event?): this Removes all listeners, or those of the specified eventName
.
+It is bad practice to remove listeners added elsewhere in the code,
+particularly when the EventEmitter
instance was created by some other
+component or module (e.g. sockets or file streams).
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Parameters
Optional
event: string | symbol
Returns this
Since
v0.1.26
+
set Max Listeners
- set
Max Listeners(n): this By default EventEmitter
s will print a warning if more than 10
listeners are
+added for a particular event. This is a useful default that helps finding
+memory leaks. The emitter.setMaxListeners()
method allows the limit to be
+modified for this specific EventEmitter
instance. The value can be set toInfinity
(or 0
) to indicate an unlimited number of listeners.
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Parameters
- n: number
Returns this
Since
v0.3.5
+
get Max Listeners
listeners
- listeners<K>(eventName): Function[]
Returns a copy of the array of listeners for the event named eventName
.
+server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
+
+Type Parameters
Parameters
- eventName: string | symbol
Returns Function[]
Since
v0.1.26
+
raw Listeners
- raw
Listeners<K>(eventName): Function[] Returns a copy of the array of listeners for the event named eventName
,
+including any wrappers (such as those created by .once()
).
+const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
+
+Type Parameters
Parameters
- eventName: string | symbol
Returns Function[]
Since
v9.4.0
+
emit
- emit<K>(eventName, ...args): boolean
Synchronously calls each of the listeners registered for the event namedeventName
, in the order they were registered, passing the supplied arguments
+to each.
+Returns true
if the event had listeners, false
otherwise.
+const EventEmitter = require('events');
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
+
+Type Parameters
Parameters
- eventName: string | symbol
Rest
...args: AnyRest
Returns boolean
Since
v0.1.26
+
listener Count
- listener
Count<K>(eventName, listener?): number Returns the number of listeners listening to the event named eventName
.
+If listener
is provided, it will return how many times the listener
+is found in the list of the listeners of the event.
+Type Parameters
Parameters
- eventName: string | symbol
The name of the event being listened for
+ Optional
listener: FunctionThe event handler function
+
Returns number
Since
v3.2.0
+
event Names
- event
Names(): (string | symbol)[] Returns an array listing the events for which the emitter has registered
+listeners. The values in the array are strings or Symbol
s.
+const EventEmitter = require('events');
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
+
+Returns (string | symbol)[]
Since
v6.0.0
+
child
- child<ChildCustomLevels>(bindings, options?): Logger<CustomLevels | ChildCustomLevels>
Creates a child logger, setting all key-value pairs in bindings
as properties in the log lines. All serializers will be applied to the given pair.
+Child loggers use the same output stream as the parent and inherit the current log level of the parent at the time they are spawned.
+From v2.x.x the log level of a child is mutable (whereas in v1.x.x it was immutable), and can be set independently of the parent.
+If a level
property is present in the object passed to child
it will override the child logger level.
+Type Parameters
Parameters
- bindings: Bindings
Optional
options: ChildLoggerOptions<ChildCustomLevels>
Returns Logger<CustomLevels | ChildCustomLevels>
a child logger instance.
+
on
- on(event, listener): this
Registers a listener function that is triggered when the level is changed.
+Note: When browserified, this functionality will only be available if the events
module has been required elsewhere
+(e.g. if you're using streams in the browser). This allows for a trade-off between bundle size and functionality.
+Parameters
- event: "level-change"
- listener: LevelChangeEventListener<CustomLevels>
Returns this
add Listener
- add
Listener(event, listener): this Alias for emitter.on(eventName, listener)
.
+Parameters
- event: "level-change"
- listener: LevelChangeEventListener<CustomLevels>
Returns this
Since
v0.1.26
+
once
- once(event, listener): this
Adds a one-timelistener
function for the event named eventName
. The
+next time eventName
is triggered, this listener is removed and then invoked.
+server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
+By default, event listeners are invoked in the order they are added. Theemitter.prependOnceListener()
method can be used as an alternative to add the
+event listener to the beginning of the listeners array.
+const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
+
+Parameters
- event: "level-change"
The name of the event.
+ - listener: LevelChangeEventListener<CustomLevels>
The callback function
+
Returns this
Since
v0.3.0
+
prepend Listener
- prepend
Listener(event, listener): this Adds the listener
function to the beginning of the listeners array for the
+event named eventName
. No checks are made to see if the listener
has
+already been added. Multiple calls passing the same combination of eventName
and listener
will result in the listener
being added, and called, multiple
+times.
+server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Parameters
- event: "level-change"
The name of the event.
+ - listener: LevelChangeEventListener<CustomLevels>
The callback function
+
Returns this
Since
v6.0.0
+
prepend Once Listener
- prepend
Once Listener(event, listener): this Adds a one-timelistener
function for the event named eventName
to the beginning of the listeners array. The next time eventName
is triggered, this
+listener is removed, and then invoked.
+server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Parameters
- event: "level-change"
The name of the event.
+ - listener: LevelChangeEventListener<CustomLevels>
The callback function
+
Returns this
Since
v6.0.0
+
remove Listener
- remove
Listener(event, listener): this Removes the specified listener
from the listener array for the event namedeventName
.
+const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
+
+removeListener()
will remove, at most, one instance of a listener from the
+listener array. If any single listener has been added multiple times to the
+listener array for the specified eventName
, then removeListener()
must be
+called multiple times to remove each instance.
+Once an event is emitted, all listeners attached to it at the
+time of emitting are called in order. This implies that anyremoveListener()
or removeAllListeners()
calls after emitting and before the last listener finishes execution
+will not remove them fromemit()
in progress. Subsequent events behave as expected.
+const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
+
+Because listeners are managed using an internal array, calling this will
+change the position indices of any listener registered after the listener
+being removed. This will not impact the order in which listeners are called,
+but it means that any copies of the listener array as returned by
+the emitter.listeners()
method will need to be recreated.
+When a single function has been added as a handler multiple times for a single
+event (as in the example below), removeListener()
will remove the most
+recently added instance. In the example the once('ping')
listener is removed:
+const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
+
+Returns a reference to the EventEmitter
, so that calls can be chained.
+Parameters
- event: "level-change"
- listener: LevelChangeEventListener<CustomLevels>
Returns this
Since
v0.1.26
+
is Level Enabled
- is
Level Enabled(level): boolean A utility method for determining if a given log level will write to the destination.
+Parameters
- level: LevelWithSilentOrString
Returns boolean
bindings
set Bindings
- set
Bindings(bindings): void Adds to the bindings of this logger instance.
+Note: Does not overwrite bindings. Can potentially result in duplicate keys in log lines.
+Parameters
- bindings: Bindings
Returns void
flush
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.PromiseLike.html b/interfaces/index._internal_.PromiseLike.html
new file mode 100644
index 0000000..1f168f4
--- /dev/null
+++ b/interfaces/index._internal_.PromiseLike.html
@@ -0,0 +1,6 @@
+PromiseLike | @foxxmd/logging Docs Interface PromiseLike<T>
interface PromiseLike<T> {
then<TResult1, TResult2>(onfulfilled?, onrejected?): PromiseLike<TResult1 | TResult2>;
} Type Parameters
Index
Methods
then
+Methods
then
- then<TResult1, TResult2>(onfulfilled?, onrejected?): PromiseLike<TResult1 | TResult2>
Attaches callbacks for the resolution and/or rejection of the Promise.
+Type Parameters
- TResult1 = T
- TResult2 = never
Parameters
Optional
onfulfilled: ((value) => TResult1 | PromiseLike<TResult1>)The callback to execute when the Promise is resolved.
+- (value): TResult1 | PromiseLike<TResult1>
Parameters
- value: T
Returns TResult1 | PromiseLike<TResult1>
Optional
onrejected: ((reason) => TResult2 | PromiseLike<TResult2>)The callback to execute when the Promise is rejected.
+- (reason): TResult2 | PromiseLike<TResult2>
Parameters
- reason: any
Returns TResult2 | PromiseLike<TResult2>
Returns PromiseLike<TResult1 | TResult2>
A Promise for the completion of which ever callback is executed.
+
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.StaticEventEmitterOptions.html b/interfaces/index._internal_.StaticEventEmitterOptions.html
new file mode 100644
index 0000000..2a59a25
--- /dev/null
+++ b/interfaces/index._internal_.StaticEventEmitterOptions.html
@@ -0,0 +1,2 @@
+StaticEventEmitterOptions | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.StreamEntry-1.html b/interfaces/index._internal_.StreamEntry-1.html
new file mode 100644
index 0000000..2da1b42
--- /dev/null
+++ b/interfaces/index._internal_.StreamEntry-1.html
@@ -0,0 +1,3 @@
+StreamEntry | @foxxmd/logging Docs Interface StreamEntry<TLevel>
Type Parameters
- TLevel = Level
Hierarchy (view full)
- StreamEntry<TLevel>
- StreamEntry
Properties
stream
Optional
level
Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.StreamEntry.html b/interfaces/index._internal_.StreamEntry.html
new file mode 100644
index 0000000..7d2e743
--- /dev/null
+++ b/interfaces/index._internal_.StreamEntry.html
@@ -0,0 +1,3 @@
+StreamEntry | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_._DOMEventTarget.html b/interfaces/index._internal_._DOMEventTarget.html
new file mode 100644
index 0000000..41c4fdf
--- /dev/null
+++ b/interfaces/index._internal_._DOMEventTarget.html
@@ -0,0 +1,2 @@
+_DOMEventTarget | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_._NodeEventTarget.html b/interfaces/index._internal_._NodeEventTarget.html
new file mode 100644
index 0000000..704d39e
--- /dev/null
+++ b/interfaces/index._internal_._NodeEventTarget.html
@@ -0,0 +1,2 @@
+_NodeEventTarget | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/interfaces/index._internal_.redactOptions.html b/interfaces/index._internal_.redactOptions.html
new file mode 100644
index 0000000..c0eaea1
--- /dev/null
+++ b/interfaces/index._internal_.redactOptions.html
@@ -0,0 +1,4 @@
+redactOptions | @foxxmd/logging Docs Interface redactOptions
interface redactOptions {
paths: string[];
censor?: string | ((value, path) => any);
remove?: boolean;
}Properties
paths
paths: string[]Optional
censor
censor?: string | ((value, path) => any)Type declaration
- (value, path): any
Parameters
- value: any
- path: string[]
Returns any
Optional
remove
remove?: booleanGenerated using TypeDoc
\ No newline at end of file
diff --git a/media/example.png b/media/example.png
new file mode 100644
index 0000000..a9bbfd7
Binary files /dev/null and b/media/example.png differ
diff --git a/modules/factory._internal_.html b/modules/factory._internal_.html
new file mode 100644
index 0000000..85647e4
--- /dev/null
+++ b/modules/factory._internal_.html
@@ -0,0 +1,15 @@
+<internal> | @foxxmd/logging Docs Module <internal>
Index
Interfaces
Type Aliases
Generated using TypeDoc
\ No newline at end of file
diff --git a/modules/factory.html b/modules/factory.html
index 57da2c3..e9e14ae 100644
--- a/modules/factory.html
+++ b/modules/factory.html
@@ -1,4 +1,7 @@
-factory | @foxxmd/logging Docs Module factory
Index
Variables
pretty Console
+factory | @foxxmd/logging Docs Module factory
Index
Modules
Type Aliases
Variables
Functions
build Destination Rolling File
build Destination File
diff --git a/modules/index._internal_.EventEmitter-1.html b/modules/index._internal_.EventEmitter-1.html
new file mode 100644
index 0000000..b124c08
--- /dev/null
+++ b/modules/index._internal_.EventEmitter-1.html
@@ -0,0 +1,6 @@
+EventEmitter | @foxxmd/logging Docs Namespace EventEmitter
Index
References
Classes
Interfaces
References
Event Emitter
Re-exports EventEmitterGenerated using TypeDoc
\ No newline at end of file
diff --git a/modules/index._internal_.html b/modules/index._internal_.html
new file mode 100644
index 0000000..76b5006
--- /dev/null
+++ b/modules/index._internal_.html
@@ -0,0 +1,49 @@
+<internal> | @foxxmd/logging Docs Module <internal>
Index
Namespaces
Classes
Interfaces
Async Resource Options
+Event Emitter Options
+_ Node Event Target
+_DOMEvent Target
+Static Event Emitter Options
+Call Site
+redact Options
+Logger Extras
+Base Logger
+Destination Stream
+Stream Entry
+Level Mapping
+Log Fn
+Child Logger Options
+Child Logger Options
+Log Fn
+Stream Entry
+Iterator Yield Result
+Iterator Return Result
+Async Iterator
+Async Iterable Iterator
+Promise Like
+Type Aliases
Generated using TypeDoc
\ No newline at end of file
diff --git a/modules/index.html b/modules/index.html
index c1b05af..928f288 100644
--- a/modules/index.html
+++ b/modules/index.html
@@ -1,4 +1,5 @@
-index | @foxxmd/logging Docs Module index
Index
Interfaces
Log Options
+index | @foxxmd/logging Docs Module index
Index
Modules
Interfaces
Type Aliases
Log Level
Logger
Log Level Stream Entry
diff --git a/types/factory.FileDestination.html b/types/factory.FileDestination.html
new file mode 100644
index 0000000..c61b066
--- /dev/null
+++ b/types/factory.FileDestination.html
@@ -0,0 +1 @@
+FileDestination | @foxxmd/logging Docs Type alias FileDestination
Type declaration
path: string | (() => string)
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory.StreamDestination.html b/types/factory.StreamDestination.html
new file mode 100644
index 0000000..0d1791d
--- /dev/null
+++ b/types/factory.StreamDestination.html
@@ -0,0 +1 @@
+StreamDestination | @foxxmd/logging Docs Type alias StreamDestination
Stream Destination: Omit<PrettyOptions_, "destination"> & {
destination: number | DestinationStream | WritableStream;
}Type declaration
destination: number | DestinationStream | WritableStream
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.BufferEncoding.html b/types/factory._internal_.BufferEncoding.html
new file mode 100644
index 0000000..14aff5a
--- /dev/null
+++ b/types/factory._internal_.BufferEncoding.html
@@ -0,0 +1 @@
+BufferEncoding | @foxxmd/logging Docs Type alias BufferEncoding
Buffer Encoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex"Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.Color.html b/types/factory._internal_.Color.html
new file mode 100644
index 0000000..542aa53
--- /dev/null
+++ b/types/factory._internal_.Color.html
@@ -0,0 +1 @@
+Color | @foxxmd/logging Docs Type alias Color
Color: ((text) => string)Type declaration
- (text): string
Parameters
- text: string | number
Returns string
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.Exclude.html b/types/factory._internal_.Exclude.html
new file mode 100644
index 0000000..f770e28
--- /dev/null
+++ b/types/factory._internal_.Exclude.html
@@ -0,0 +1,2 @@
+Exclude | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.LevelPrettifierExtras.html b/types/factory._internal_.LevelPrettifierExtras.html
new file mode 100644
index 0000000..5d0b9a5
--- /dev/null
+++ b/types/factory._internal_.LevelPrettifierExtras.html
@@ -0,0 +1 @@
+LevelPrettifierExtras | @foxxmd/logging Docs Type alias LevelPrettifierExtras
Level Prettifier Extras: {
label: string;
labelColorized: string;
}Type declaration
label: string
label Colorized: string
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.LogDescriptor.html b/types/factory._internal_.LogDescriptor.html
new file mode 100644
index 0000000..15626d7
--- /dev/null
+++ b/types/factory._internal_.LogDescriptor.html
@@ -0,0 +1 @@
+LogDescriptor | @foxxmd/logging Docs Type alias LogDescriptor
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.MessageFormatFunc.html b/types/factory._internal_.MessageFormatFunc.html
new file mode 100644
index 0000000..328d2a0
--- /dev/null
+++ b/types/factory._internal_.MessageFormatFunc.html
@@ -0,0 +1 @@
+MessageFormatFunc | @foxxmd/logging Docs Type alias MessageFormatFunc
Message Format Func: ((log, messageKey, levelLabel, extras) => string)Type declaration
- (log, messageKey, levelLabel, extras): string
Parameters
- log: LogDescriptor
- messageKey: string
- levelLabel: string
- extras: PrettifierExtras
Returns string
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.Omit.html b/types/factory._internal_.Omit.html
new file mode 100644
index 0000000..772f724
--- /dev/null
+++ b/types/factory._internal_.Omit.html
@@ -0,0 +1,2 @@
+Omit | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.Pick.html b/types/factory._internal_.Pick.html
new file mode 100644
index 0000000..6df148c
--- /dev/null
+++ b/types/factory._internal_.Pick.html
@@ -0,0 +1,2 @@
+Pick | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.Prettifier.html b/types/factory._internal_.Prettifier.html
new file mode 100644
index 0000000..fac3fed
--- /dev/null
+++ b/types/factory._internal_.Prettifier.html
@@ -0,0 +1 @@
+Prettifier | @foxxmd/logging Docs Type alias Prettifier<T>
Type Parameters
Type declaration
- (inputData, key, log, extras): string
Parameters
- inputData: string | object
- key: string
- log: object
- extras: PrettifierExtras<T>
Returns string
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/factory._internal_.PrettifierExtras.html b/types/factory._internal_.PrettifierExtras.html
new file mode 100644
index 0000000..999abea
--- /dev/null
+++ b/types/factory._internal_.PrettifierExtras.html
@@ -0,0 +1 @@
+PrettifierExtras | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index.LogData.html b/types/index.LogData.html
index 8f61c1d..c46b85c 100644
--- a/types/index.LogData.html
+++ b/types/index.LogData.html
@@ -1 +1 @@
-LogData | @foxxmd/logging Docs Type alias LogData
Log Data: Record<string, any> & {
level: number;
time: number;
pid: number;
hostname: string;
labels: any[];
msg: string | Error | ErrorWithCause;
}Type declaration
level: number
time: number
pid: number
hostname: string
labels: any[]
msg: string | Error | ErrorWithCause
Generated using TypeDoc
\ No newline at end of file
+LogData | @foxxmd/logging Docs Type alias LogData
Log Data: Record<string, any> & {
level: number;
time: number;
pid: number;
hostname: string;
labels: any[];
msg: string | Error | ErrorWithCause;
}Type declaration
level: number
time: number
pid: number
hostname: string
labels: any[]
msg: string | Error | ErrorWithCause
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index.LogLevel.html b/types/index.LogLevel.html
index 2fff266..ad999ba 100644
--- a/types/index.LogLevel.html
+++ b/types/index.LogLevel.html
@@ -1 +1 @@
-LogLevel | @foxxmd/logging Docs Type alias LogLevel
Generated using TypeDoc
\ No newline at end of file
+LogLevel | @foxxmd/logging Docs Type alias LogLevel
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index.LogLevelStreamEntry.html b/types/index.LogLevelStreamEntry.html
index a0f0bba..a378a4d 100644
--- a/types/index.LogLevelStreamEntry.html
+++ b/types/index.LogLevelStreamEntry.html
@@ -1 +1 @@
-LogLevelStreamEntry | @foxxmd/logging Docs Type alias LogLevelStreamEntry
Generated using TypeDoc
\ No newline at end of file
+LogLevelStreamEntry | @foxxmd/logging Docs Type alias LogLevelStreamEntry
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index.Logger.html b/types/index.Logger.html
index 25687e7..44a38e6 100644
--- a/types/index.Logger.html
+++ b/types/index.Logger.html
@@ -1 +1 @@
-Logger | @foxxmd/logging Docs Type alias Logger
Type declaration
labels: any[]
add Label: ((value) => void)
- (value): void
Parameters
- value: any
Returns void
Generated using TypeDoc
\ No newline at end of file
+Logger | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.AnyRest.html b/types/index._internal_.AnyRest.html
new file mode 100644
index 0000000..02bbdeb
--- /dev/null
+++ b/types/index._internal_.AnyRest.html
@@ -0,0 +1 @@
+AnyRest | @foxxmd/logging Docs Type alias AnyRest
Any Rest: [args: any[]]Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Args.html b/types/index._internal_.Args.html
new file mode 100644
index 0000000..5924b21
--- /dev/null
+++ b/types/index._internal_.Args.html
@@ -0,0 +1 @@
+Args | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Bindings.html b/types/index._internal_.Bindings.html
new file mode 100644
index 0000000..f442563
--- /dev/null
+++ b/types/index._internal_.Bindings.html
@@ -0,0 +1 @@
+Bindings | @foxxmd/logging Docs Type alias Bindings
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.CustomLevelLogger.html b/types/index._internal_.CustomLevelLogger.html
new file mode 100644
index 0000000..2d49f47
--- /dev/null
+++ b/types/index._internal_.CustomLevelLogger.html
@@ -0,0 +1 @@
+CustomLevelLogger | @foxxmd/logging Docs Type alias CustomLevelLogger<CustomLevels>
Type Parameters
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.DefaultEventMap.html b/types/index._internal_.DefaultEventMap.html
new file mode 100644
index 0000000..82fa25f
--- /dev/null
+++ b/types/index._internal_.DefaultEventMap.html
@@ -0,0 +1 @@
+DefaultEventMap | @foxxmd/logging Docs Type alias DefaultEventMap
Default Event Map: [never]Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.EventMap.html b/types/index._internal_.EventMap.html
new file mode 100644
index 0000000..1b3867a
--- /dev/null
+++ b/types/index._internal_.EventMap.html
@@ -0,0 +1 @@
+EventMap | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.IteratorResult.html b/types/index._internal_.IteratorResult.html
new file mode 100644
index 0000000..0f4841e
--- /dev/null
+++ b/types/index._internal_.IteratorResult.html
@@ -0,0 +1 @@
+IteratorResult | @foxxmd/logging Docs Type alias IteratorResult<T, TReturn>
Type Parameters
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Key.html b/types/index._internal_.Key.html
new file mode 100644
index 0000000..1509d41
--- /dev/null
+++ b/types/index._internal_.Key.html
@@ -0,0 +1 @@
+Key | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Key2.html b/types/index._internal_.Key2.html
new file mode 100644
index 0000000..0cf00a7
--- /dev/null
+++ b/types/index._internal_.Key2.html
@@ -0,0 +1 @@
+Key2 | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Level-1.html b/types/index._internal_.Level-1.html
new file mode 100644
index 0000000..40b9180
--- /dev/null
+++ b/types/index._internal_.Level-1.html
@@ -0,0 +1 @@
+Level | @foxxmd/logging Docs Type alias Level
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Level.html b/types/index._internal_.Level.html
new file mode 100644
index 0000000..1d30928
--- /dev/null
+++ b/types/index._internal_.Level.html
@@ -0,0 +1 @@
+Level | @foxxmd/logging Docs Type alias Level
Level: "fatal" | "error" | "warn" | "info" | "debug" | "trace"Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.LevelChangeEventListener.html b/types/index._internal_.LevelChangeEventListener.html
new file mode 100644
index 0000000..4602871
--- /dev/null
+++ b/types/index._internal_.LevelChangeEventListener.html
@@ -0,0 +1 @@
+LevelChangeEventListener | @foxxmd/logging Docs Type alias LevelChangeEventListener<CustomLevels>
Type Parameters
Type declaration
- (lvl, val, prevLvl, prevVal, logger): void
Parameters
- lvl: LevelWithSilentOrString
- val: number
- prevLvl: LevelWithSilentOrString
- prevVal: number
- logger: Logger<CustomLevels>
Returns void
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.LevelOrString.html b/types/index._internal_.LevelOrString.html
new file mode 100644
index 0000000..733943c
--- /dev/null
+++ b/types/index._internal_.LevelOrString.html
@@ -0,0 +1 @@
+LevelOrString | @foxxmd/logging Docs Type alias LevelOrString
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.LevelWithSilent.html b/types/index._internal_.LevelWithSilent.html
new file mode 100644
index 0000000..0d70219
--- /dev/null
+++ b/types/index._internal_.LevelWithSilent.html
@@ -0,0 +1 @@
+LevelWithSilent | @foxxmd/logging Docs Type alias LevelWithSilent
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.LevelWithSilentOrString.html b/types/index._internal_.LevelWithSilentOrString.html
new file mode 100644
index 0000000..8de8287
--- /dev/null
+++ b/types/index._internal_.LevelWithSilentOrString.html
@@ -0,0 +1 @@
+LevelWithSilentOrString | @foxxmd/logging Docs Type alias LevelWithSilentOrString
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Listener.html b/types/index._internal_.Listener.html
new file mode 100644
index 0000000..79c581a
--- /dev/null
+++ b/types/index._internal_.Listener.html
@@ -0,0 +1 @@
+Listener | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Logger-1.html b/types/index._internal_.Logger-1.html
new file mode 100644
index 0000000..1dc235d
--- /dev/null
+++ b/types/index._internal_.Logger-1.html
@@ -0,0 +1 @@
+Logger | @foxxmd/logging Docs Type alias Logger<CustomLevels>
Type Parameters
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Logger.html b/types/index._internal_.Logger.html
new file mode 100644
index 0000000..85042fa
--- /dev/null
+++ b/types/index._internal_.Logger.html
@@ -0,0 +1 @@
+Logger | @foxxmd/logging Docs Type alias Logger<CustomLevels>
Type Parameters
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.OnChildCallback.html b/types/index._internal_.OnChildCallback.html
new file mode 100644
index 0000000..d404d68
--- /dev/null
+++ b/types/index._internal_.OnChildCallback.html
@@ -0,0 +1,2 @@
+OnChildCallback | @foxxmd/logging Docs Type alias OnChildCallback<CustomLevels>
A synchronous callback that will run on each creation of a new child.
+Type Parameters
Type declaration
- (child): void
Parameters
- child: Logger<CustomLevels>
Returns void
Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Record.html b/types/index._internal_.Record.html
new file mode 100644
index 0000000..0ff4ed8
--- /dev/null
+++ b/types/index._internal_.Record.html
@@ -0,0 +1,2 @@
+Record | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.Required.html b/types/index._internal_.Required.html
new file mode 100644
index 0000000..2bedf99
--- /dev/null
+++ b/types/index._internal_.Required.html
@@ -0,0 +1,2 @@
+Required | @foxxmd/logging Docs Generated using TypeDoc
\ No newline at end of file
diff --git a/types/index._internal_.SerializerFn.html b/types/index._internal_.SerializerFn.html
new file mode 100644
index 0000000..af1fb3b
--- /dev/null
+++ b/types/index._internal_.SerializerFn.html
@@ -0,0 +1 @@
+SerializerFn | @foxxmd/logging Docs Type alias SerializerFn
Serializer Fn: ((value) => any)Type declaration
- (value): any
Parameters
- value: any
Returns any
Generated using TypeDoc
\ No newline at end of file
diff --git a/variables/factory.prettyConsole.html b/variables/factory.prettyConsole.html
index 70a8da6..6823cc9 100644
--- a/variables/factory.prettyConsole.html
+++ b/variables/factory.prettyConsole.html
@@ -1 +1 @@
-prettyConsole | @foxxmd/logging Docs Variable prettyConsoleConst
pretty Console: PrettyOptions = ...Generated using TypeDoc
\ No newline at end of file
+prettyConsole | @foxxmd/logging Docs Variable prettyConsoleConst
Generated using TypeDoc
\ No newline at end of file
diff --git a/variables/factory.prettyFile.html b/variables/factory.prettyFile.html
index fe2551d..c03172a 100644
--- a/variables/factory.prettyFile.html
+++ b/variables/factory.prettyFile.html
@@ -1 +1 @@
-prettyFile | @foxxmd/logging Docs Variable prettyFileConst
pretty File: PrettyOptions = ...Generated using TypeDoc
\ No newline at end of file
+prettyFile | @foxxmd/logging Docs Variable prettyFileConst
Generated using TypeDoc
\ No newline at end of file
diff --git a/variables/index.LOG_LEVELS.html b/variables/index.LOG_LEVELS.html
index 35eb300..54be655 100644
--- a/variables/index.LOG_LEVELS.html
+++ b/variables/index.LOG_LEVELS.html
@@ -1 +1 @@
-LOG_LEVELS | @foxxmd/logging Docs Variable LOG_LEVELSConst
LOG_ LEVELS: readonly ["silent", "fatal", "error", "warn", "info", "log", "verbose", "debug"] = ...Generated using TypeDoc
\ No newline at end of file
+LOG_LEVELS | @foxxmd/logging Docs Variable LOG_LEVELSConst
LOG_ LEVELS: readonly ["silent", "fatal", "error", "warn", "info", "log", "verbose", "debug"] = ...Generated using TypeDoc
\ No newline at end of file
diff --git a/variables/index.loggerDebug.html b/variables/index.loggerDebug.html
index bdafcb4..1659b12 100644
--- a/variables/index.loggerDebug.html
+++ b/variables/index.loggerDebug.html
@@ -1 +1 @@
-loggerDebug | @foxxmd/logging Docs Variable loggerDebugConst
Generated using TypeDoc
\ No newline at end of file
+loggerDebug | @foxxmd/logging Docs Variable loggerDebugConst
Generated using TypeDoc
\ No newline at end of file
diff --git a/variables/index.loggerTest.html b/variables/index.loggerTest.html
index fece51a..54ead87 100644
--- a/variables/index.loggerTest.html
+++ b/variables/index.loggerTest.html
@@ -1 +1 @@
-loggerTest | @foxxmd/logging Docs Variable loggerTestConst
Generated using TypeDoc
\ No newline at end of file
+loggerTest | @foxxmd/logging Docs Variable loggerTestConst
Generated using TypeDoc
\ No newline at end of file
The class
+AsyncResource
is designed to be extended by the embedder's async +resources. Using this, users can easily trigger the lifetime events of their +own resources.The
+init
hook will trigger when anAsyncResource
is instantiated.The following is an overview of the
+ +AsyncResource
API.