@river-build/dlog
Advanced tools
Comparing version 0.0.27 to 0.0.28
@@ -15,3 +15,3 @@ import { Err } from '@river-build/proto'; | ||
const e = new CodeException(message ?? 'Unknown', code ?? Err.ERR_UNSPECIFIED, data); | ||
log('throwWithCode', e.message, e.stack); | ||
log('throwWithCode', e); | ||
throw e; | ||
@@ -18,0 +18,0 @@ } |
@@ -98,2 +98,3 @@ import { bin_toHexString, isHexString, shortenHexString } from './binary'; | ||
const allDlogs = new Map(); | ||
const isDev = typeof process !== 'undefined' && process.env.NODE_ENV === 'development'; | ||
const makeDlog = (d, opts) => { | ||
@@ -122,7 +123,7 @@ if (opts?.printStack) { | ||
if (c instanceof Error) { | ||
tailArgs.push('\n'); | ||
isDev ? fmt.push('%O\n') : fmt.push('%o\n'); | ||
tailArgs.push(c); | ||
} | ||
else { | ||
fmt.push('%O\n'); | ||
isDev ? fmt.push('%O\n') : fmt.push('%o\n'); | ||
newArgs.push(cloneAndFormat(c, { shortenHex: true })); | ||
@@ -132,3 +133,3 @@ } | ||
else { | ||
fmt.push('%O '); | ||
isDev ? fmt.push('%O ') : fmt.push('%o '); | ||
newArgs.push(c); | ||
@@ -135,0 +136,0 @@ } |
@@ -7,2 +7,4 @@ /** | ||
import { bin_fromHexString } from '../binary'; | ||
import { CodeException } from '../check'; | ||
import { Err } from '@river-build/proto'; | ||
describe('dlogTest', () => { | ||
@@ -182,3 +184,16 @@ test('basic', () => { | ||
}); | ||
test('handle error', () => { | ||
const e = new CodeException('test', Err.ERR_UNSPECIFIED); | ||
const log = dlogError('test:dlog'); | ||
log.enabled = true; | ||
let output = ''; | ||
log.baseDebug.log = (...args) => { | ||
for (const arg of args) { | ||
output += `${arg}`; | ||
} | ||
}; | ||
log('throwWithCode', e); | ||
expect(output).toContain('CodeException [Error]: test at Object.<anonymous>'); | ||
}); | ||
}); | ||
//# sourceMappingURL=dlog.test.js.map |
{ | ||
"name": "@river-build/dlog", | ||
"version": "0.0.27", | ||
"version": "0.0.28", | ||
"packageManager": "yarn@3.8.0", | ||
@@ -22,3 +22,3 @@ "type": "module", | ||
"@bufbuild/protobuf": "^1.9.0", | ||
"@river-build/proto": "^0.0.27", | ||
"@river-build/proto": "^0.0.28", | ||
"browser-or-node": "^2.1.1", | ||
@@ -46,3 +46,3 @@ "debug": "^4.3.4", | ||
], | ||
"gitHead": "a5f49a28e7b6947b6e65e500e0e860474014f1c7" | ||
"gitHead": "8198ded419044570801554db8b16bf5325eae424" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46188
596
4
+ Added@river-build/proto@0.0.28(transitive)
- Removed@river-build/proto@0.0.27(transitive)
Updated@river-build/proto@^0.0.28