mirror of
https://github.com/bitwarden/browser
synced 2026-02-14 07:23:45 +00:00
introduce DefaultSendAccessService.authenticate$
This commit is contained in:
@@ -48,6 +48,19 @@ export class DefaultSemanticLogger<Context extends object> implements SemanticLo
|
||||
throw new Error(panicMessage);
|
||||
}
|
||||
|
||||
panicWhen<T>(
|
||||
when: boolean,
|
||||
content: Jsonify<T> | string,
|
||||
message?: string,
|
||||
): when is false | never {
|
||||
if (when) {
|
||||
// type conversion safe because Jsonify<string> === string
|
||||
this.panic(content as Jsonify<T | string>, message);
|
||||
}
|
||||
|
||||
return !when;
|
||||
}
|
||||
|
||||
private log<T>(content: Jsonify<T>, level: LogLevelType, message?: string) {
|
||||
const log = {
|
||||
...this.context,
|
||||
|
||||
@@ -92,4 +92,24 @@ export interface SemanticLogger {
|
||||
|
||||
/** combined signature for overloaded methods */
|
||||
panic<T>(content: Jsonify<T> | string, message?: string): never;
|
||||
|
||||
/** Conditionally panics.
|
||||
* @param when - when this condition is true, the logger panics.
|
||||
* @param message - a message to record in the log's `message` field.
|
||||
*/
|
||||
panicWhen(when: boolean, message: string): when is false | never;
|
||||
|
||||
/** Conditionally panics.
|
||||
* @param when - when this condition is true, the logger panics.
|
||||
* @param content - JSON content included in the log's `content` field.
|
||||
* @param message - a message to record in the log's `message` field.
|
||||
*/
|
||||
panicWhen<T>(when: boolean, content: Jsonify<T>, message?: string): when is false | never;
|
||||
|
||||
/** combined signature for overloaded methods */
|
||||
panicWhen<T>(
|
||||
when: boolean,
|
||||
content: Jsonify<T> | string,
|
||||
message?: string,
|
||||
): when is false | never;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user