Function
logMessage
(
logFunction: AllowedLogFunction,
type: string,
message: string,
err?: Error,
contexts: string[] = [],
)
Source from the content-addressed store, hash-verified
| 57 | } |
| 58 | |
| 59 | function logMessage( |
| 60 | logFunction: AllowedLogFunction, |
| 61 | type: string, |
| 62 | message: string, |
| 63 | err?: Error, |
| 64 | contexts: string[] = [], |
| 65 | ) { |
| 66 | const args: (string | Error)[] = [`[${type}]`, message]; |
| 67 | |
| 68 | if (contexts.length) { |
| 69 | const combined = contexts.join(' >> '); |
| 70 | args.push(`[${combined}]`); |
| 71 | } |
| 72 | |
| 73 | if (err) { |
| 74 | args.push(err); |
| 75 | } |
| 76 | |
| 77 | logFunction(...args); |
| 78 | } |
Tested by
no test coverage detected