Improved logging

This commit is contained in:
Unknown 2018-01-24 14:07:59 +10:30
parent 19579930e8
commit 03335f3949
1 changed files with 7 additions and 7 deletions

View File

@ -179,14 +179,14 @@ func (r *revidInst)IsRunning() bool {
func (r *revidInst) Start() {
if r.isRunning {
r.Log(Warning,"Start() has been called but revid already running!")
r.Log(Warning,"revidInst.Start() called but revid already running!")
return
}
r.Log(Debug,"Starting Revid!")
r.Log(Info,"Starting Revid!")
var h264Data []byte
switch r.config.Input {
case Raspivid:
r.Log(Debug,"Starting raspivid!")
r.Log(Info,"Starting raspivid!")
cmd = exec.Command("raspivid", "-o", "-", "-n", "-t", "0", "-b",
r.config.Bitrate,"-qp", r.config.Quantization, "-w", r.config.Width, "-h", r.config.Height, "-fps", r.config.FrameRate, "-ih", "-g", "100")
stdout, _ := cmd.StdoutPipe()
@ -198,7 +198,7 @@ func (r *revidInst) Start() {
}
r.isRunning = true
go func() {
r.Log(Debug, "Reading camera data!")
r.Log(Info, "Reading camera data!")
for r.isRunning {
h264Data = make([]byte, 1)
_, err := io.ReadFull(inputReader, h264Data)
@ -214,7 +214,7 @@ func (r *revidInst) Start() {
r.h264Parser.InputByteChan <- h264Data[0]
}
}
r.Log(Debug, "Out of reading routine!")
r.Log(Info, "Out of reading routine!")
}()
case File:
stats, err := r.inputFile.Stat()
@ -236,11 +236,11 @@ func (r *revidInst) Start() {
func (r *revidInst) Stop() {
if r.isRunning {
r.Log(Debug,"Stopping revid!")
r.Log(Info,"Stopping revid!")
r.isRunning = false
cmd.Process.Kill()
} else {
r.Log(Warning,"Tried to stop revid, but not even running!")
r.Log(Warning,"revidInst.Stop() called but revid not running!")
}
}