@bayou/see-all
Advanced tools
Comparing version 1.0.6 to 1.2.4
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -375,3 +375,3 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> | ||
// Append the stack if available and appropriate. See the header doc for | ||
// Append the stack if available and appropriate. See the header comment for | ||
// more info. | ||
@@ -501,2 +501,23 @@ if ( this.isMessage() | ||
/** | ||
* Constructs an instance just like this one, except with `payload` replaced | ||
* with the indicated contents. It is only valid to call this method on | ||
* instances for which {@link #isEvent} returns `true`; other cases will | ||
* throw an error. | ||
* | ||
* @param {payload} payload New payload. | ||
* @returns {LogRecord} An appropriately-constructed instance. | ||
*/ | ||
withEvent(payload) { | ||
const { timeMsec, stack, tag } = this; | ||
if (!this.isEvent()) { | ||
throw Errors.badUse('Requires an event instance.'); | ||
} else if (!DataUtil.isDeepFrozen(payload.args)) { | ||
throw Errors.badValue(payload, 'deep-frozen data'); | ||
} | ||
return new LogRecord(timeMsec, stack, tag, payload); | ||
} | ||
/** | ||
* Constructs an instance just like this one, except with `message` replaced | ||
@@ -523,2 +544,15 @@ * with the indicated contents. It is only valid to call this method on | ||
/** | ||
* Constructs an instance just like this one, except with `tag` replaced as | ||
* indicated contents. | ||
* | ||
* @param {LogTag} tag New tag. | ||
* @returns {LogRecord} An appropriately-constructed instance. | ||
*/ | ||
withTag(tag) { | ||
const { timeMsec, stack, payload } = this; | ||
return new LogRecord(timeMsec, stack, tag, payload); | ||
} | ||
/** | ||
* Calls `util.inspect()` on the given value, with standardized options. | ||
@@ -525,0 +559,0 @@ * |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -7,6 +7,6 @@ { | ||
"dependencies": { | ||
"@bayou/util-common": "1.0.6" | ||
"@bayou/util-common": "1.2.4" | ||
}, | ||
"name": "@bayou/see-all", | ||
"version": "1.0.6" | ||
"version": "1.2.4" | ||
} |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -9,2 +9,3 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> | ||
import { LogRecord, LogTag } from '@bayou/see-all'; | ||
import { Functor } from '@bayou/util-common'; | ||
@@ -89,2 +90,62 @@ describe('@bayou/see-all/LogRecord', () => { | ||
}); | ||
describe('withEvent()', () => { | ||
it('is an error to call on a message log', () => { | ||
const lr = LogRecord.forMessage(123, 'trace', new LogTag('taggaroo'), 'info', 'boop'); | ||
const f = new Functor('x', 1, 2); | ||
assert.throws(() => { lr.withEvent(f); }); | ||
}); | ||
it('is an error to pass a payload that is not frozen data', () => { | ||
const lr = LogRecord.forMessage(123, 'trace', new LogTag('taggaroo'), 'info', 'boop'); | ||
const f = new Functor('x', ['this', 'array', 'is', 'not', 'frozen']); | ||
assert.throws(() => { lr.withEvent(f); }); | ||
}); | ||
it('operates as expected on an event log, given a valid value', () => { | ||
const LOG_TAG = new LogTag('taggaroo'); | ||
const lr = LogRecord.forEvent(123321, 'zorch', LOG_TAG, new Functor('x', 1, 2)); | ||
const f = new Functor('y', 'z'); | ||
const newLr = lr.withEvent(f); | ||
assert.strictEqual(newLr.payload, f); | ||
assert.strictEqual(newLr.timeMsec, lr.timeMsec); | ||
assert.strictEqual(newLr.stack, lr.stack); | ||
assert.strictEqual(newLr.tag, LOG_TAG); | ||
}); | ||
}); | ||
describe('withTag()', () => { | ||
it('operates as expected on a message log', () => { | ||
const LOG_TAG_1 = new LogTag('one'); | ||
const LOG_TAG_2 = new LogTag('two', 'three'); | ||
const lr = LogRecord.forMessage(123, 'trace', LOG_TAG_1, 'info', 'x', 'y', 'z'); | ||
const newLr = lr.withTag(LOG_TAG_2); | ||
assert.strictEqual(newLr.tag, LOG_TAG_2); | ||
assert.strictEqual(newLr.timeMsec, lr.timeMsec); | ||
assert.strictEqual(newLr.stack, lr.stack); | ||
assert.strictEqual(newLr.messageString, lr.messageString); | ||
}); | ||
it('operates as expected on an event log', () => { | ||
const LOG_TAG_1 = new LogTag('uno'); | ||
const LOG_TAG_2 = new LogTag('dos', 'tres'); | ||
const lr = LogRecord.forEvent(123321, 'zorch', LOG_TAG_1, new Functor('x', 1, 2)); | ||
const newLr = lr.withTag(LOG_TAG_2); | ||
assert.strictEqual(newLr.tag, LOG_TAG_2); | ||
assert.strictEqual(newLr.timeMsec, lr.timeMsec); | ||
assert.strictEqual(newLr.stack, lr.stack); | ||
assert.strictEqual(newLr.payload, lr.payload); | ||
}); | ||
}); | ||
}); |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
@@ -1,2 +0,2 @@ | ||
// Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia). | ||
// Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia). | ||
// Licensed AS IS and WITHOUT WARRANTY under the Apache License, | ||
@@ -3,0 +3,0 @@ // Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
60642
18
1586
1
5
+ Added@bayou/typecheck@1.2.4(transitive)
+ Added@bayou/util-common@1.2.4(transitive)
+ Added@bayou/util-core@1.2.4(transitive)
- Removed@bayou/typecheck@1.0.6(transitive)
- Removed@bayou/util-common@1.0.6(transitive)
- Removed@bayou/util-core@1.0.6(transitive)
Updated@bayou/util-common@1.2.4