mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-26 13:20:48 +00:00
Import log instead of using it off of window
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
import { noop } from 'lodash';
|
||||
import { LogLevel } from './shared';
|
||||
import { LogFunction } from '../types/Logging';
|
||||
|
||||
type LogAtLevelFnType = (
|
||||
level: LogLevel,
|
||||
@@ -12,23 +13,18 @@ type LogAtLevelFnType = (
|
||||
let logAtLevel: LogAtLevelFnType = noop;
|
||||
let hasInitialized = false;
|
||||
|
||||
type LogFn = (...args: ReadonlyArray<unknown>) => void;
|
||||
|
||||
export type LoggerType = {
|
||||
fatal: LogFn;
|
||||
error: LogFn;
|
||||
warn: LogFn;
|
||||
info: LogFn;
|
||||
debug: LogFn;
|
||||
trace: LogFn;
|
||||
};
|
||||
|
||||
export const fatal: LogFn = (...args) => logAtLevel(LogLevel.Fatal, ...args);
|
||||
export const error: LogFn = (...args) => logAtLevel(LogLevel.Error, ...args);
|
||||
export const warn: LogFn = (...args) => logAtLevel(LogLevel.Warn, ...args);
|
||||
export const info: LogFn = (...args) => logAtLevel(LogLevel.Info, ...args);
|
||||
export const debug: LogFn = (...args) => logAtLevel(LogLevel.Debug, ...args);
|
||||
export const trace: LogFn = (...args) => logAtLevel(LogLevel.Trace, ...args);
|
||||
export const fatal: LogFunction = (...args) =>
|
||||
logAtLevel(LogLevel.Fatal, ...args);
|
||||
export const error: LogFunction = (...args) =>
|
||||
logAtLevel(LogLevel.Error, ...args);
|
||||
export const warn: LogFunction = (...args) =>
|
||||
logAtLevel(LogLevel.Warn, ...args);
|
||||
export const info: LogFunction = (...args) =>
|
||||
logAtLevel(LogLevel.Info, ...args);
|
||||
export const debug: LogFunction = (...args) =>
|
||||
logAtLevel(LogLevel.Debug, ...args);
|
||||
export const trace: LogFunction = (...args) =>
|
||||
logAtLevel(LogLevel.Trace, ...args);
|
||||
|
||||
/**
|
||||
* Sets the low-level logging interface. Should be called early in a process's life, and
|
||||
|
||||
Reference in New Issue
Block a user