Files
notesnook/apps/mobile/app/common/logger/index.ts

28 lines
532 B
TypeScript
Raw Normal View History

2022-05-21 17:46:47 +05:00
function info(context: string, ...logs: any[]) {
console.log(`${new Date().toLocaleDateString()}::info::${context}:`, ...logs);
}
function error(context: string, ...logs: any[]) {
console.log(
`${new Date().toLocaleDateString()}::error::${context}: `,
...logs
);
2022-05-21 17:46:47 +05:00
}
type Logger = {
info: (context: string, ...logs: any[]) => void;
error: (context: string, ...logs: any[]) => void;
};
declare global {
// eslint-disable-next-line no-var
var logger: Logger;
}
global.logger = {
info,
error
};
export {};