mirror of
https://git.hibas.dev/OpenServer/NodeLogging.git
synced 2025-04-06 05:42:58 +00:00
29 lines
778 B
TypeScript
29 lines
778 B
TypeScript
export { FileAdapter } from "./filewriter";
|
|
import { FileAdapter } from "./filewriter";
|
|
import { LoggingBase } from "@hibas123/logging";
|
|
import Logging from "@hibas123/logging";
|
|
|
|
LoggingBase.nativeFunctions = {
|
|
startTimer: () => {
|
|
if (process.hrtime.bigint) {
|
|
return process.hrtime.bigint();
|
|
} else {
|
|
return process.hrtime();
|
|
}
|
|
},
|
|
endTimer: (start) => {
|
|
if (process.hrtime.bigint) {
|
|
return Number((process.hrtime.bigint() - start) / BigInt(1000)) / 1000;
|
|
} else {
|
|
let diff = process.hrtime(start);
|
|
return diff[0] * 1000 + diff[1] / 1000000;
|
|
}
|
|
},
|
|
};
|
|
|
|
export const DefaultFileAdapter = new FileAdapter("./logs/all.log");
|
|
|
|
Logging.addAdapter(DefaultFileAdapter);
|
|
|
|
export default Logging;
|