mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
send attachment to mobile and take picture
This commit is contained in:
@@ -65,3 +65,4 @@ export class ColoredLoggerService {
|
||||
|
||||
fatal(error?: any, message?: string, context?: string): void {}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
// import { DateUtils } from './date';
|
||||
|
||||
export type MessageType = {
|
||||
message: string;
|
||||
context?: string;
|
||||
obj?: object;
|
||||
};
|
||||
|
||||
function getCurrentTime() {
|
||||
const now = new Date();
|
||||
const hours = String(now.getHours()).padStart(2, '0');
|
||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(now.getSeconds()).padStart(2, '0');
|
||||
const milliseconds = String(now.getMilliseconds()).padStart(3, '0');
|
||||
return `${hours}:${minutes}:${seconds}.${milliseconds}`;
|
||||
}
|
||||
|
||||
export class Logger {
|
||||
|
||||
constructor() {}
|
||||
|
||||
static log(message: string, obj = {}): void {
|
||||
console.log(
|
||||
`[${getCurrentTime()}] %cINFO : `, // Console Message
|
||||
'color: #00897B', // CSS Style
|
||||
Object.assign(obj, { createdAt: getCurrentTime(), message })
|
||||
);
|
||||
}
|
||||
|
||||
static debug(message: string, obj = {}): void {
|
||||
console.info(
|
||||
`[${getCurrentTime()}] %cINFO : `, // Console Message
|
||||
'color: #039BE5', // CSS Style
|
||||
Object.assign(obj, {createdAt: getCurrentTime(), message })
|
||||
);
|
||||
}
|
||||
|
||||
static info(message: string, obj = {}): void {
|
||||
console.info(
|
||||
`[${getCurrentTime()}] %cINFO : `, // Console Message
|
||||
'color: #039BE5', // CSS Style
|
||||
Object.assign(obj, { createdAt: getCurrentTime(), message })
|
||||
);
|
||||
}
|
||||
|
||||
static warn(message: string, obj = {}): void {
|
||||
console.warn(
|
||||
`[${getCurrentTime()}] %cWARN : `, // Console Message
|
||||
'color: #FB8C00', // CSS Style
|
||||
Object.assign(obj, { createdAt: getCurrentTime(), message })
|
||||
);
|
||||
}
|
||||
|
||||
static error(message?: string, obj = {}): void {
|
||||
|
||||
console.error(
|
||||
`[${getCurrentTime()}] %cERROR : `, // Console Message
|
||||
'color: #E53935', // CSS Style
|
||||
message+', '+
|
||||
'\n',
|
||||
(obj as any)?.error,
|
||||
'\n',
|
||||
);
|
||||
}
|
||||
|
||||
fatal(error?: any, message?: string, context?: string): void {}
|
||||
}
|
||||
Reference in New Issue
Block a user