@node-dlc/logger
Version:
18 lines (13 loc) • 403 B
text/typescript
import fs from 'fs';
import { ITransport } from '../transport';
export class FileTransport implements ITransport {
public filePath: string;
public fileDescriptor: number;
constructor(filepath: string) {
this.filePath = filepath;
this.fileDescriptor = fs.openSync(filepath, 'a', 0o666);
}
public write(line: string): void {
fs.writeSync(this.fileDescriptor, line + '\n');
}
}