import fs from 'fs'
import path from 'path'
import { LoggerProcessorContract, BasePlugin } from '@codeceptjs-plugins/base'
const logFileStream = fs.createWriteStream(path.resolve(global.output_dir, 'custom.log'))
const output = new console.Console(logFileStream, logFileStream)
class CustomLoggerProcessor implements LoggerProcessorContract {
info(message: string): void {
output.log('info', message)
}
debug(scope: string, message: string): void {
output.log('debug', scope, message)
}
error(message: string): void {
output.log('error', message)
}
}
class CustomPlugin extends BasePlugin {
constructor(config) {
super(config, {namespace: 'my-custom-plugin', loggerProcessor: new CustomLoggerProcessor()})
}
}