File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " nerdctl" ,
3- "version" : " 0.3.6 " ,
3+ "version" : " 0.3.7 " ,
44 "main" : " dist/index.js" ,
55 "types" : " dist/index.d.ts" ,
66 "description" : " Node wrapper for nerdctl" ,
Original file line number Diff line number Diff line change 1919 */
2020
2121import { Console } from "console" ;
22+ import { EventEmitter } from "events" ;
2223import fs from "fs" ;
2324import path from "path" ;
2425import stream from "stream" ;
@@ -33,8 +34,9 @@ export function setLogLevel(level: logLevel): void {
3334 LOG_LEVEL = level ;
3435}
3536
36- export class Log {
37+ export class Log extends EventEmitter {
3738 constructor ( topic : string , directory : string ) {
39+ super ( ) ;
3840 this . path = path . join ( directory , `${ topic } .log` ) ;
3941
4042 fs . mkdirSync ( directory , { recursive : true } ) ;
@@ -107,6 +109,7 @@ export class Log {
107109 message : any ,
108110 optionalParameters : any [ ]
109111 ) {
112+ this . emit ( "log" , message , method ) ;
110113 this . console [ method ] ( `%s: ${ message } ` , new Date ( ) , ...optionalParameters ) ;
111114 }
112115
Original file line number Diff line number Diff line change 1+ import * as events from "@/constants/events" ;
2+
13import { ImageResult , RemoveImageCommandFlags } from "@/types/images" ;
24import {
35 RemoveCommandFlags ,
@@ -23,6 +25,9 @@ export default abstract class BaseBackend extends EventEmitter {
2325 super ( ) ;
2426 this . path = path ;
2527 this . log = new Log ( APP_NAME , join ( this . resourcePath , "logs" ) ) ;
28+ this . log . on ( "log" , ( message : string , type : string ) => {
29+ this . emit ( events . VM_INIT_OUTPUT , message , type ) ;
30+ } ) ;
2631 }
2732
2833 protected get resourcePath ( ) {
You can’t perform that action at this time.
0 commit comments