logger/index.ts

26 lines
758 B
TypeScript
Raw Normal View History

2023-06-15 12:13:46 +02:00
import MasterLogger from './src/MasterLogger.js';
2023-04-12 19:13:14 +02:00
import LoggerClient from './src/LoggerClient.js';
2023-06-15 12:13:46 +02:00
import Defaults, { LogLevel } from './src/Defaults.js';
2023-04-12 19:13:14 +02:00
2023-12-06 12:07:18 +01:00
export { WriteOptions, LogFunction, Loggable } from './src/Types.js';
2023-04-16 15:53:37 +02:00
export { LoggerClientOptions, LoggerMasterOptions } from './src/Defaults.js';
2023-06-15 12:13:46 +02:00
const addLogLevel = (name: string, level: number) =>
{
2023-04-13 15:25:49 +02:00
if (typeof name !== 'string')
throw new Error('Name must be a string');
if (typeof level !== 'number')
throw new Error('Level must be a number');
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
LogLevel[LogLevel[name] = level] = name;
};
2023-04-16 15:53:37 +02:00
2023-04-13 18:15:36 +02:00
export {
MasterLogger,
2023-04-16 15:53:37 +02:00
LoggerClient,
2023-12-06 12:07:18 +01:00
Defaults,
LogLevel,
addLogLevel,
2023-04-16 15:53:37 +02:00
};