mconfig subcommand ready

This commit is contained in:
vcptr
2019-12-14 23:48:56 +08:00
parent 7b289d16cf
commit 904db6bd61
7 changed files with 135 additions and 22 deletions
+9
View File
@@ -119,6 +119,15 @@ func CreateStdoutLogWriter() WriterCreator {
}
}
// CreateStderrLogWriter returns a LogWriterCreator that creates LogWriter for stderr.
func CreateStderrLogWriter() WriterCreator {
return func() Writer {
return &consoleLogWriter{
logger: log.New(os.Stderr, "", log.Ldate|log.Ltime),
}
}
}
// CreateFileLogWriter returns a LogWriterCreator that creates LogWriter for the given file.
func CreateFileLogWriter(path string) (WriterCreator, error) {
file, err := os.OpenFile(path, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
+3
View File
@@ -39,6 +39,9 @@ func Run(args []string, input io.Reader) (buf.MultiBuffer, error) {
}
return nil, newError(msg).Base(err)
}
if !errBuffer.IsEmpty() {
newError("v2ctl > ", errBuffer.String()).AtInfo().WriteToLog()
}
return outBuffer.MultiBuffer, nil
}