You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
775 B
35 lines
775 B
enum LoggingLevel {
|
|
Silent = 0,
|
|
Success = 1,
|
|
Error = 2,
|
|
Warning = 3,
|
|
Info = 4,
|
|
Debug = 5,
|
|
Verbose = 6,
|
|
}
|
|
|
|
const isLoggingLevel = (something: any): something is LoggingLevel => {
|
|
return [
|
|
LoggingLevel.Silent,
|
|
LoggingLevel.Success,
|
|
LoggingLevel.Error,
|
|
LoggingLevel.Warning,
|
|
LoggingLevel.Info,
|
|
LoggingLevel.Debug,
|
|
LoggingLevel.Verbose
|
|
].includes(something)
|
|
}
|
|
|
|
interface LogMessage {
|
|
level: LoggingLevel,
|
|
date: Date,
|
|
output: any,
|
|
caller_name: string,
|
|
}
|
|
|
|
const isLogMessage = (something: any): something is LogMessage => {
|
|
return isLoggingLevel(something?.level) && something?.date instanceof Date;
|
|
}
|
|
|
|
export { LoggingLevel, LogMessage, isLoggingLevel, isLogMessage }
|