Import log instead of using it off of window
This commit is contained in:
parent
8eb0dd3116
commit
65ddf0a9e8
155 changed files with 3654 additions and 3433 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue