From 6e773abd4ed134f08e880a4f765dffa69191b028 Mon Sep 17 00:00:00 2001 From: saxon Date: Thu, 20 Sep 2018 11:23:52 +0930 Subject: [PATCH] revid: made logging messages lowercase and removed exclamation marks --- revid/revid.go | 68 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/revid/revid.go b/revid/revid.go index 71064b07..72af0aad 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -154,7 +154,7 @@ func (r *Revid) reset(config Config) error { if r.destination != nil { err = r.destination.close() if err != nil { - r.config.Logger.Log(smartlogger.Error, pkg+"Could not close destination", "error", err.Error()) + r.config.Logger.Log(smartlogger.Error, pkg+"could not close destination", "error", err.Error()) } } switch r.config.Output { @@ -188,10 +188,10 @@ func (r *Revid) reset(config Config) error { } switch r.config.InputCodec { case H264: - r.config.Logger.Log(smartlogger.Info, pkg+"Using H264 lexer") + r.config.Logger.Log(smartlogger.Info, pkg+"using H264 lexer") r.lexTo = lex.H264 case Mjpeg: - r.config.Logger.Log(smartlogger.Info, pkg+"Using MJPEG lexer") + r.config.Logger.Log(smartlogger.Info, pkg+"using MJPEG lexer") r.lexTo = lex.MJPEG } @@ -217,11 +217,11 @@ func (r *Revid) reset(config Config) error { r.getFrame = r.getFrameNoPacketization return nil case Mpegts: - r.config.Logger.Log(smartlogger.Info, pkg+"Using MPEGTS packetisation") + r.config.Logger.Log(smartlogger.Info, pkg+"using MPEGTS packetisation") frameRate, _ := strconv.ParseFloat(r.config.FrameRate, 64) r.encoder = mts.NewEncoder(frameRate) case Flv: - r.config.Logger.Log(smartlogger.Info, pkg+"Using FLV packetisation") + r.config.Logger.Log(smartlogger.Info, pkg+"using FLV packetisation") frameRate, _ := strconv.Atoi(r.config.FrameRate) r.encoder = flv.NewEncoder(true, true, frameRate) } @@ -241,31 +241,31 @@ func (r *Revid) IsRunning() bool { // and packetising (if theres packetization) to a defined output. func (r *Revid) Start() { if r.isRunning { - r.config.Logger.Log(smartlogger.Warning, pkg+"Revid.Start() called but revid already running!") + r.config.Logger.Log(smartlogger.Warning, pkg+"revid.Start() called but revid already running") return } - r.config.Logger.Log(smartlogger.Info, pkg+"Starting Revid") - r.config.Logger.Log(smartlogger.Debug, pkg+"Setting up output") + r.config.Logger.Log(smartlogger.Info, pkg+"starting Revid") + r.config.Logger.Log(smartlogger.Debug, pkg+"setting up output") r.isRunning = true - r.config.Logger.Log(smartlogger.Info, pkg+"Starting output routine") + r.config.Logger.Log(smartlogger.Info, pkg+"starting output routine") go r.outputClips() - r.config.Logger.Log(smartlogger.Info, pkg+"Starting clip packing routine") + r.config.Logger.Log(smartlogger.Info, pkg+"starting clip packing routine") go r.packClips() - r.config.Logger.Log(smartlogger.Info, pkg+"Setting up input and receiving content") + r.config.Logger.Log(smartlogger.Info, pkg+"setting up input and receiving content") go r.setupInput() } // Stop halts any processing of video data from a camera or file func (r *Revid) Stop() { if !r.isRunning { - r.config.Logger.Log(smartlogger.Warning, pkg+"Revid.Stop() called but revid not running!") + r.config.Logger.Log(smartlogger.Warning, pkg+"revid.Stop() called but revid not running") return } - r.config.Logger.Log(smartlogger.Info, pkg+"Stopping revid!") + r.config.Logger.Log(smartlogger.Info, pkg+"stopping revid") r.isRunning = false - r.config.Logger.Log(smartlogger.Info, pkg+"Killing input proccess!") + r.config.Logger.Log(smartlogger.Info, pkg+"killing input proccess") // If a cmd process is running, we kill! if r.cmd != nil && r.cmd.Process != nil { r.cmd.Process.Kill() @@ -299,7 +299,7 @@ func (r *Revid) packClips() { case frame := <-r.encoder.Stream(): lenOfFrame := len(frame) if lenOfFrame > ringBufferElementSize { - r.config.Logger.Log(smartlogger.Warning, pkg+"Frame was too big", "frame size", lenOfFrame) + r.config.Logger.Log(smartlogger.Warning, pkg+"frame was too big", "frame size", lenOfFrame) frame = r.getFrame() lenOfFrame = len(frame) } @@ -308,7 +308,7 @@ func (r *Revid) packClips() { if err == ring.ErrDropped { r.config.Logger.Log(smartlogger.Warning, pkg+"dropped frame", "frame size", len(frame)) } else { - r.config.Logger.Log(smartlogger.Error, pkg+"Unexpected ringbuffer write error", + r.config.Logger.Log(smartlogger.Error, pkg+"unexpected ringbuffer write error", "error", err.Error()) } } @@ -352,27 +352,27 @@ func (r *Revid) outputClips() { } bytes += chunk.Len() - r.config.Logger.Log(smartlogger.Debug, pkg+"About to send") + r.config.Logger.Log(smartlogger.Debug, pkg+"about to send") err = r.destination.load(chunk) if err != nil { - r.config.Logger.Log(smartlogger.Error, pkg+"Failed to load clip") + r.config.Logger.Log(smartlogger.Error, pkg+"failed to load clip") } err = r.destination.send() if err == nil { - r.config.Logger.Log(smartlogger.Debug, pkg+"Sent clip") + r.config.Logger.Log(smartlogger.Debug, pkg+"sent clip") } if r.isRunning && err != nil && chunk.Len() > 11 { - r.config.Logger.Log(smartlogger.Debug, pkg+"Send failed! Trying again") + r.config.Logger.Log(smartlogger.Debug, pkg+"send failed, trying again") // Try and send again err = r.destination.send() - r.config.Logger.Log(smartlogger.Error, pkg+"Destination send error", "error", err.Error()) + r.config.Logger.Log(smartlogger.Error, pkg+"destination send error", "error", err.Error()) // if there's still an error we try and reconnect, unless we're stopping for r.isRunning && err != nil { - r.config.Logger.Log(smartlogger.Debug, pkg+"Send failed a again! Trying to reconnect...") + r.config.Logger.Log(smartlogger.Debug, pkg+"send failed a again, trying to reconnect...") time.Sleep(time.Duration(sendFailedDelay) * time.Millisecond) - r.config.Logger.Log(smartlogger.Error, pkg+"Send failed with error", "error", err.Error()) + r.config.Logger.Log(smartlogger.Error, pkg+"send failed with error", "error", err.Error()) if rs, ok := r.destination.(restarter); ok { r.config.Logger.Log(smartlogger.Debug, pkg+"restarting session", "session", rs) @@ -386,17 +386,17 @@ func (r *Revid) outputClips() { r.config.Logger.Log(smartlogger.Info, pkg+"restarted rtmp session") } - r.config.Logger.Log(smartlogger.Debug, pkg+"Trying to send again with new connection...") + r.config.Logger.Log(smartlogger.Debug, pkg+"trying to send again with new connection") err = r.destination.send() if err != nil { - r.config.Logger.Log(smartlogger.Error, pkg+"Send failed with error", "error", err.Error()) + r.config.Logger.Log(smartlogger.Error, pkg+"send failed with error", "error", err.Error()) } } } r.destination.release() - r.config.Logger.Log(smartlogger.Debug, pkg+"Done reading that clip from ringbuffer...") + r.config.Logger.Log(smartlogger.Debug, pkg+"done reading that clip from ringbuffer") // Log some information regarding bitrate and ring buffer size if it's time now = time.Now() @@ -404,23 +404,23 @@ func (r *Revid) outputClips() { if deltaTime > bitrateTime { // FIXME(kortschak): For subsecond deltaTime, this will give infinite bitrate. r.bitrate = int(float64(bytes*8) / float64(deltaTime/time.Second)) - r.config.Logger.Log(smartlogger.Debug, pkg+"Bitrate (bits/s)", "bitrate", r.bitrate) - r.config.Logger.Log(smartlogger.Debug, pkg+"Ring buffer size", "value", r.ringBuffer.Len()) + r.config.Logger.Log(smartlogger.Debug, pkg+"bitrate (bits/s)", "bitrate", r.bitrate) + r.config.Logger.Log(smartlogger.Debug, pkg+"ring buffer size", "value", r.ringBuffer.Len()) prevTime = now bytes = 0 } } - r.config.Logger.Log(smartlogger.Info, pkg+"Not outputting clips anymore") + r.config.Logger.Log(smartlogger.Info, pkg+"not outputting clips anymore") err := r.destination.close() if err != nil { - r.config.Logger.Log(smartlogger.Error, pkg+"Failed to close destination", "error", err.Error()) + r.config.Logger.Log(smartlogger.Error, pkg+"failed to close destination", "error", err.Error()) } } // startRaspivid sets up things for input from raspivid i.e. starts // a raspivid process and pipes it's data output. func (r *Revid) startRaspivid() error { - r.config.Logger.Log(smartlogger.Info, pkg+"Starting raspivid!") + r.config.Logger.Log(smartlogger.Info, pkg+"starting raspivid") switch r.config.InputCodec { case H264: args := []string{ @@ -447,7 +447,7 @@ func (r *Revid) startRaspivid() error { } // Log all the args and create []string argsStr := strings.Join(args, " ") - r.config.Logger.Log(smartlogger.Info, pkg+"Raspivid args", "raspividArgs", argsStr) + r.config.Logger.Log(smartlogger.Info, pkg+"raspivid args", "raspividArgs", argsStr) r.cmd = exec.Command("raspivid", argsStr) case Mjpeg: @@ -470,9 +470,9 @@ func (r *Revid) startRaspivid() error { } r.inputReader = stdout go func() { - r.config.Logger.Log(smartlogger.Info, pkg+"Reading camera data!") + r.config.Logger.Log(smartlogger.Info, pkg+"reading camera data") r.lexTo(r.encoder, r.inputReader, 0) - r.config.Logger.Log(smartlogger.Info, pkg+"Not trying to read from camera anymore!") + r.config.Logger.Log(smartlogger.Info, pkg+"not trying to read from camera anymore") }() return nil }