Socket
Socket
Sign inDemoInstall

roarr

Package Overview
Dependencies
28
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.4.0 to 7.4.1

2

dist/src/types.d.ts

@@ -25,3 +25,3 @@ /// <reference types="node" />

export declare type Logger = LogMethod & {
adopt: <T>(routine: () => Promise<T>, context: MessageContext) => Promise<T>;
adopt: <T>(routine: () => T, context?: MessageContext) => Promise<T>;
child: (context: MessageContext | TranslateMessageFunction) => Logger;

@@ -28,0 +28,0 @@ debug: LogMethod;

"use strict";
/* eslint-disable max-nested-callbacks */
/* eslint-disable ava/use-test */

@@ -122,6 +123,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {

const log = createLoggerWithHistory();
log.adopt(() => {
void log.adopt(() => {
log('foo');
});
log.adopt(() => {
void log.adopt(() => {
log('bar');

@@ -146,9 +147,34 @@ });

});
(0, ava_1.serial)('top-level adopt increments global sequence (async)', async (t) => {
const log = createLoggerWithHistory();
void log.adopt(async () => {
log('foo');
});
void log.adopt(async () => {
log('bar');
});
t.deepEqual(log.messages, [
{
context: {},
message: 'foo',
sequence: '0.0',
time,
version,
},
{
context: {},
message: 'bar',
sequence: '1.0',
time,
version,
},
]);
});
(0, ava_1.serial)('logs within adopt increment local sequence', async (t) => {
const log = createLoggerWithHistory();
log.adopt(() => {
void log.adopt(() => {
log('foo');
log('bar');
});
log.adopt(() => {
void log.adopt(() => {
log('baz');

@@ -188,7 +214,48 @@ log('qux');

});
(0, ava_1.serial)('logs within adopt increment local sequence (async)', async (t) => {
const log = createLoggerWithHistory();
void log.adopt(async () => {
log('foo');
log('bar');
});
void log.adopt(async () => {
log('baz');
log('qux');
});
t.deepEqual(log.messages, [
{
context: {},
message: 'foo',
sequence: '0.0',
time,
version,
},
{
context: {},
message: 'bar',
sequence: '0.1',
time,
version,
},
{
context: {},
message: 'baz',
sequence: '1.0',
time,
version,
},
{
context: {},
message: 'qux',
sequence: '1.1',
time,
version,
},
]);
});
(0, ava_1.serial)('nested adopt increment local sequence', async (t) => {
const log = createLoggerWithHistory();
log.adopt(() => {
void log.adopt(() => {
log('foo');
log.adopt(() => {
void log.adopt(() => {
log('bar');

@@ -214,7 +281,32 @@ });

});
(0, ava_1.serial)('nested adopt increment local sequence (async)', async (t) => {
const log = createLoggerWithHistory();
void log.adopt(async () => {
log('foo');
await log.adopt(async () => {
log('bar');
});
});
t.deepEqual(log.messages, [
{
context: {},
message: 'foo',
sequence: '0.0',
time,
version,
},
{
context: {},
message: 'bar',
sequence: '0.1.0',
time,
version,
},
]);
});
(0, ava_1.serial)('adopted scope maintains reference to local sequence', async (t) => {
const log = createLoggerWithHistory();
log.adopt(() => {
void log.adopt(() => {
log('foo');
log.adopt(() => {
void log.adopt(() => {
log('bar 0');

@@ -266,7 +358,7 @@ log('bar 1');

const log = createLoggerWithHistory();
log.adopt(() => {
void log.adopt(() => {
log('foo 0');
log.adopt(() => {
void log.adopt(() => {
log('bar 0');
log.adopt(() => {
void log.adopt(() => {
log('baz 0');

@@ -273,0 +365,0 @@ setTimeout(() => {

@@ -76,3 +76,3 @@ {

"typings": "./dist/src/Roarr.d.ts",
"version": "7.4.0"
"version": "7.4.1"
}

@@ -162,2 +162,4 @@ <a name="roarr"></a>

You may also use [`@roarr/browser-log-writer`](https://github.com/gajus/roarr-browser-log-writer) that implements and opinionated browser logger with [Liqe](https://github.com/gajus/liqe) query support for filtering logs.
<a name="roarr-usage-filtering-logs"></a>

@@ -164,0 +166,0 @@ ### Filtering logs

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc