Import log instead of using it off of window

This commit is contained in:
Josh Perez 2021-09-17 14:27:53 -04:00 committed by GitHub
parent 8eb0dd3116
commit 65ddf0a9e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
155 changed files with 3654 additions and 3433 deletions

View file

@ -11,6 +11,7 @@ import { Blocked } from './storage/Blocked';
import { assert } from '../util/assert';
import Data from '../sql/Client';
import { SignalProtocolStore } from '../SignalProtocolStore';
import * as log from '../logging/log';
export class Storage implements StorageInterface {
public readonly user: User;
@ -60,7 +61,7 @@ export class Storage implements StorageInterface {
defaultValue?: V
): V | undefined {
if (!this.ready) {
window.log.warn('Called storage.get before storage is ready. key:', key);
log.warn('Called storage.get before storage is ready. key:', key);
}
const item = this.items[key];
@ -76,7 +77,7 @@ export class Storage implements StorageInterface {
value: Access[K]
): Promise<void> {
if (!this.ready) {
window.log.warn('Called storage.put before storage is ready. key:', key);
log.warn('Called storage.put before storage is ready. key:', key);
}
this.items[key] = value;
@ -87,10 +88,7 @@ export class Storage implements StorageInterface {
public async remove<K extends keyof Access>(key: K): Promise<void> {
if (!this.ready) {
window.log.warn(
'Called storage.remove before storage is ready. key:',
key
);
log.warn('Called storage.remove before storage is ready. key:', key);
}
delete this.items[key];