mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
Add logging system
This commit is contained in:
@@ -1,16 +1,29 @@
|
||||
import {logger, LogLevel} from "./logger.js";
|
||||
|
||||
// Inicjalizacja loggera dla modułu ImageCache
|
||||
const log = {
|
||||
debug: (...args) => logger.debug('ImageCache', ...args),
|
||||
info: (...args) => logger.info('ImageCache', ...args),
|
||||
warn: (...args) => logger.warn('ImageCache', ...args),
|
||||
error: (...args) => logger.error('ImageCache', ...args)
|
||||
};
|
||||
|
||||
// Konfiguracja loggera dla modułu ImageCache
|
||||
logger.setModuleLevel('ImageCache', LogLevel.INFO);
|
||||
|
||||
export class ImageCache {
|
||||
constructor() {
|
||||
this.cache = new Map();
|
||||
}
|
||||
|
||||
set(key, imageData) {
|
||||
console.log("Caching image data for key:", key);
|
||||
log.info("Caching image data for key:", key);
|
||||
this.cache.set(key, imageData);
|
||||
}
|
||||
|
||||
get(key) {
|
||||
const data = this.cache.get(key);
|
||||
console.log("Retrieved cached data for key:", key, !!data);
|
||||
log.debug("Retrieved cached data for key:", key, !!data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -19,7 +32,7 @@ export class ImageCache {
|
||||
}
|
||||
|
||||
clear() {
|
||||
console.log("Clearing image cache");
|
||||
log.info("Clearing image cache");
|
||||
this.cache.clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user