fix(clamav.manager): Improve log handling and add timeout for log reception in ClamAV manager tests
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartantivirus',
|
||||
version: '1.1.0',
|
||||
version: '1.1.1',
|
||||
description: 'A Node.js package for integrating antivirus scanning capabilities using ClamAV, allowing in-memory file and data scanning.'
|
||||
}
|
||||
|
@ -11,11 +11,16 @@ export class ClamAVManager extends EventEmitter {
|
||||
private containerName = 'clamav-daemon';
|
||||
private imageTag = 'clamav/clamav:latest';
|
||||
private port = 3310;
|
||||
private logs: ClamAVLogEvent[] = [];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
public getLogs(): ClamAVLogEvent[] {
|
||||
return this.logs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the ClamAV container if it's not already running
|
||||
*/
|
||||
@ -157,6 +162,7 @@ export class ClamAVManager extends EventEmitter {
|
||||
type: this.determineLogType(line)
|
||||
};
|
||||
|
||||
this.logs.push(event);
|
||||
this.emit('log', event);
|
||||
console.log(`[ClamAV ${event.type}] ${event.message}`);
|
||||
});
|
||||
@ -169,6 +175,7 @@ export class ClamAVManager extends EventEmitter {
|
||||
type: 'error'
|
||||
};
|
||||
|
||||
this.logs.push(event);
|
||||
this.emit('log', event);
|
||||
console.error(`[ClamAV error] ${event.message}`);
|
||||
});
|
||||
|
Reference in New Issue
Block a user