From 9454ef88c3385e72651a0483bed1a9f244bdc1e7 Mon Sep 17 00:00:00 2001 From: Alan Noble Date: Wed, 15 Jan 2020 13:46:56 +1030 Subject: [PATCH 01/12] revid/config/config.go: fixed typo in outputs data type (enums->enum) --- revid/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revid/config/config.go b/revid/config/config.go index 04d51a63..2ae14feb 100644 --- a/revid/config/config.go +++ b/revid/config/config.go @@ -332,7 +332,7 @@ var TypeData = map[string]string{ "RBWriteTimeout": "uint", "Output": "enum:File,Http,Rtmp,Rtp", "OutputPath": "string", - "Outputs": "enums:File,Http,Rtmp,Rtp", + "Outputs": "enum:File,Http,Rtmp,Rtp", "Quantization": "uint", "Rotation": "uint", "RTMPURL": "string", From 82e2df5d88affb2e08dd42caa95e40542943768d Mon Sep 17 00:00:00 2001 From: Alan Noble Date: Wed, 15 Jan 2020 13:58:51 +1030 Subject: [PATCH 02/12] revid/config/config.go: reverted incorrect change --- revid/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revid/config/config.go b/revid/config/config.go index 2ae14feb..04d51a63 100644 --- a/revid/config/config.go +++ b/revid/config/config.go @@ -332,7 +332,7 @@ var TypeData = map[string]string{ "RBWriteTimeout": "uint", "Output": "enum:File,Http,Rtmp,Rtp", "OutputPath": "string", - "Outputs": "enum:File,Http,Rtmp,Rtp", + "Outputs": "enums:File,Http,Rtmp,Rtp", "Quantization": "uint", "Rotation": "uint", "RTMPURL": "string", From 39d0fa12d04df2ec947a4cfa5e2538fae465f2d0 Mon Sep 17 00:00:00 2001 From: Saxon Date: Sat, 18 Jan 2020 09:54:12 +1030 Subject: [PATCH 03/12] cmd/revid-cli: send logs using smartlogger --- cmd/revid-cli/main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index bced0a4f..87185323 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -72,7 +72,10 @@ const ( var canProfile = true // The logger that will be used throughout. -var log *logger.Logger +var ( + smartLog *smartlogger.Smartlogger + log *logger.Logger +) const ( metaPreambleKey = "copyright" @@ -160,7 +163,8 @@ func handleFlags() config.Config { cfg.LogLevel = defaultLogVerbosity } - log = logger.New(cfg.LogLevel, &smartlogger.New(*logPathPtr).LogRoller, true) + smartLog = smartlogger.New(*logPathPtr) + log = logger.New(cfg.LogLevel, &smartLog.LogRoller, true) cfg.Logger = log @@ -351,6 +355,8 @@ func run(cfg config.Config) { ns.SetMode(paused, &vs) } + smartLog.SendLogs(ns) + sleep: sleepTime, err := strconv.Atoi(ns.Param("mp")) if err != nil { From b1a7adc487f2b1b75c0f11b2c8b53c582afa6c25 Mon Sep 17 00:00:00 2001 From: Scott Date: Mon, 20 Jan 2020 10:32:22 +1030 Subject: [PATCH 04/12] cmd/revid-cli: send logs using netlogger --- cmd/revid-cli/main.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index 87185323..d5cc51db 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -32,7 +32,9 @@ package main import ( "flag" + "io" "os" + "path/filepath" "runtime/pprof" "strconv" "strings" @@ -44,10 +46,11 @@ import ( "bitbucket.org/ausocean/av/device/raspivid" "bitbucket.org/ausocean/av/revid" "bitbucket.org/ausocean/av/revid/config" + "bitbucket.org/ausocean/iot/pi/netlogger" "bitbucket.org/ausocean/iot/pi/netsender" "bitbucket.org/ausocean/iot/pi/sds" - "bitbucket.org/ausocean/iot/pi/smartlogger" "bitbucket.org/ausocean/utils/logger" + "gopkg.in/natefinch/lumberjack.v2" ) // Revid modes @@ -73,8 +76,8 @@ var canProfile = true // The logger that will be used throughout. var ( - smartLog *smartlogger.Smartlogger - log *logger.Logger + netLogger *netlogger.NetLogger + log *logger.Logger ) const ( @@ -163,8 +166,16 @@ func handleFlags() config.Config { cfg.LogLevel = defaultLogVerbosity } - smartLog = smartlogger.New(*logPathPtr) - log = logger.New(cfg.LogLevel, &smartLog.LogRoller, true) + netLogger = netlogger.New() + log = logger.New(cfg.LogLevel, io.MultiWriter( + &lumberjack.Logger{ + Filename: filepath.Join(*logPathPtr, "netsender.log"), + MaxSize: 500, // megabytes + MaxBackups: 10, + MaxAge: 28, // days + }, + netLogger, + ), true) cfg.Logger = log @@ -355,7 +366,7 @@ func run(cfg config.Config) { ns.SetMode(paused, &vs) } - smartLog.SendLogs(ns) + netLogger.SendLogs(ns) sleep: sleepTime, err := strconv.Atoi(ns.Param("mp")) From e4315d8203fdf909cef7517280cd58eca8845da7 Mon Sep 17 00:00:00 2001 From: Scott Date: Mon, 20 Jan 2020 10:50:02 +1030 Subject: [PATCH 05/12] cmd/revid-cli: added error checking for sending of logs --- cmd/revid-cli/main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index d5cc51db..d319d4fe 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -311,6 +311,11 @@ func run(cfg config.Config) { continue } + err = netLogger.SendLogs(ns) + if err != nil { + log.Log(logger.Warning, pkg+"Logs could not be sent", "error", err.Error()) + } + // If var sum hasn't changed we continue. var vars map[string]string newVs := ns.VarSum() @@ -366,8 +371,6 @@ func run(cfg config.Config) { ns.SetMode(paused, &vs) } - netLogger.SendLogs(ns) - sleep: sleepTime, err := strconv.Atoi(ns.Param("mp")) if err != nil { From 8c82a03c2551a14f71e9fe7a9d39bbeb692ad27a Mon Sep 17 00:00:00 2001 From: Scott Date: Mon, 20 Jan 2020 16:20:35 +1030 Subject: [PATCH 06/12] cmd/revid-cli/main.go: Renamed SendLogs to Send. --- cmd/revid-cli/main.go | 2 +- go.mod | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index d319d4fe..ee892df9 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -311,7 +311,7 @@ func run(cfg config.Config) { continue } - err = netLogger.SendLogs(ns) + err = netLogger.Send(ns) if err != nil { log.Log(logger.Warning, pkg+"Logs could not be sent", "error", err.Error()) } diff --git a/go.mod b/go.mod index 632c0ebb..f9a618a0 100644 --- a/go.mod +++ b/go.mod @@ -12,4 +12,5 @@ require ( github.com/pkg/errors v0.8.1 github.com/yobert/alsa v0.0.0-20180630182551-d38d89fa843e gocv.io/x/gocv v0.21.0 + gopkg.in/natefinch/lumberjack.v2 v2.0.0 ) From 9d2fd533358b02e7d2ad3ac1139fa1be930c0cd3 Mon Sep 17 00:00:00 2001 From: Scott Date: Wed, 22 Jan 2020 15:33:23 +1030 Subject: [PATCH 07/12] megabytes -> MB --- cmd/revid-cli/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index ee892df9..d7bdd267 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -170,7 +170,7 @@ func handleFlags() config.Config { log = logger.New(cfg.LogLevel, io.MultiWriter( &lumberjack.Logger{ Filename: filepath.Join(*logPathPtr, "netsender.log"), - MaxSize: 500, // megabytes + MaxSize: 500, // MB MaxBackups: 10, MaxAge: 28, // days }, From 93f7d5849e8dfc47e3b255ac5a59c1060d2bd216 Mon Sep 17 00:00:00 2001 From: Scott Date: Wed, 22 Jan 2020 15:36:20 +1030 Subject: [PATCH 08/12] Added newlines to logger.New --- cmd/revid-cli/main.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index d7bdd267..67cddc0a 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -167,15 +167,19 @@ func handleFlags() config.Config { } netLogger = netlogger.New() - log = logger.New(cfg.LogLevel, io.MultiWriter( - &lumberjack.Logger{ - Filename: filepath.Join(*logPathPtr, "netsender.log"), - MaxSize: 500, // MB - MaxBackups: 10, - MaxAge: 28, // days - }, - netLogger, - ), true) + log = logger.New( + cfg.LogLevel, + io.MultiWriter( + &lumberjack.Logger{ + Filename: filepath.Join(*logPathPtr, "netsender.log"), + MaxSize: 500, // MB + MaxBackups: 10, + MaxAge: 28, // days + }, + netLogger, + ), + true, + ) cfg.Logger = log From 0cfa93a314aa8782c99491c338bf887eb5679695 Mon Sep 17 00:00:00 2001 From: Scott Date: Wed, 22 Jan 2020 16:34:20 +1030 Subject: [PATCH 09/12] Uses iot v1.2.12 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f9a618a0..c7100214 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module bitbucket.org/ausocean/av go 1.13 require ( - bitbucket.org/ausocean/iot v1.2.11 + bitbucket.org/ausocean/iot v1.2.12 bitbucket.org/ausocean/utils v1.2.12 github.com/Comcast/gots v0.0.0-20190305015453-8d56e473f0f7 github.com/go-audio/audio v0.0.0-20181013203223-7b2a6ca21480 diff --git a/go.sum b/go.sum index b0fee827..87d44284 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ bitbucket.org/ausocean/iot v1.2.10 h1:TTu+ykH5gQA8wU/pN0aS55ySQ/XcGxV4s4LKx3Wye5 bitbucket.org/ausocean/iot v1.2.10/go.mod h1:Q5FwaOKnCty3dVeVtki6DLwYa5vhNpOaeu1lwLyPCg8= bitbucket.org/ausocean/iot v1.2.11 h1:MwYQK1F2ESA5jPVSCB0lBUN8HBiNDHGkh/OMGJKw8Oc= bitbucket.org/ausocean/iot v1.2.11/go.mod h1:Q5FwaOKnCty3dVeVtki6DLwYa5vhNpOaeu1lwLyPCg8= +bitbucket.org/ausocean/iot v1.2.12 h1:Ixf0CTmWOMJVrJ6IYMEluTrCLlu9LM1eNSBZ+ZUnDmU= +bitbucket.org/ausocean/iot v1.2.12/go.mod h1:Q5FwaOKnCty3dVeVtki6DLwYa5vhNpOaeu1lwLyPCg8= bitbucket.org/ausocean/utils v1.2.11 h1:zA0FOaPjN960ryp8PKCkV5y50uWBYrIxCVnXjwbvPqg= bitbucket.org/ausocean/utils v1.2.11/go.mod h1:uXzX9z3PLemyURTMWRhVI8uLhPX4uuvaaO85v2hcob8= bitbucket.org/ausocean/utils v1.2.12 h1:VnskjWTDM475TnQRhBQE0cNp9D6Y6OELrd4UkD2VVIQ= From 0e94a0172bb454948a1823ab4d8f930f0c8e7e24 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 23 Jan 2020 09:41:54 +1030 Subject: [PATCH 10/12] cmd/revid-cli/main.go: netlogger.NetLogger -> netlogger.Logger --- cmd/revid-cli/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index 67cddc0a..38cb71b4 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -76,7 +76,7 @@ var canProfile = true // The logger that will be used throughout. var ( - netLogger *netlogger.NetLogger + netLogger *netlogger.Logger log *logger.Logger ) From 62141926ff8f00d9afa15490f21d75d562328f7e Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 23 Jan 2020 10:01:16 +1030 Subject: [PATCH 11/12] =?UTF-8?q?main:=20netLogger=20=E2=86=92=20netLog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/revid-cli/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index 38cb71b4..db6e17ec 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -76,8 +76,8 @@ var canProfile = true // The logger that will be used throughout. var ( - netLogger *netlogger.Logger - log *logger.Logger + netLog *netlogger.Logger + log *logger.Logger ) const ( @@ -166,7 +166,7 @@ func handleFlags() config.Config { cfg.LogLevel = defaultLogVerbosity } - netLogger = netlogger.New() + netLog = netlogger.New() log = logger.New( cfg.LogLevel, io.MultiWriter( @@ -176,7 +176,7 @@ func handleFlags() config.Config { MaxBackups: 10, MaxAge: 28, // days }, - netLogger, + netLog, ), true, ) @@ -315,7 +315,7 @@ func run(cfg config.Config) { continue } - err = netLogger.Send(ns) + err = netLog.Send(ns) if err != nil { log.Log(logger.Warning, pkg+"Logs could not be sent", "error", err.Error()) } From 44508fd2691ed2403bf3d5b7dc441508fd9caa8a Mon Sep 17 00:00:00 2001 From: Scott Date: Fri, 24 Jan 2020 15:36:27 +1030 Subject: [PATCH 12/12] use iot v1.2.13 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c7100214..2ed4c734 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module bitbucket.org/ausocean/av go 1.13 require ( - bitbucket.org/ausocean/iot v1.2.12 + bitbucket.org/ausocean/iot v1.2.13 bitbucket.org/ausocean/utils v1.2.12 github.com/Comcast/gots v0.0.0-20190305015453-8d56e473f0f7 github.com/go-audio/audio v0.0.0-20181013203223-7b2a6ca21480 diff --git a/go.sum b/go.sum index 87d44284..ef1fb9ff 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ bitbucket.org/ausocean/iot v1.2.11 h1:MwYQK1F2ESA5jPVSCB0lBUN8HBiNDHGkh/OMGJKw8O bitbucket.org/ausocean/iot v1.2.11/go.mod h1:Q5FwaOKnCty3dVeVtki6DLwYa5vhNpOaeu1lwLyPCg8= bitbucket.org/ausocean/iot v1.2.12 h1:Ixf0CTmWOMJVrJ6IYMEluTrCLlu9LM1eNSBZ+ZUnDmU= bitbucket.org/ausocean/iot v1.2.12/go.mod h1:Q5FwaOKnCty3dVeVtki6DLwYa5vhNpOaeu1lwLyPCg8= +bitbucket.org/ausocean/iot v1.2.13 h1:E9LcW3HYqRgJqxNhPJUCfVRvoV2IAU4B7JSDNxB/x2k= +bitbucket.org/ausocean/iot v1.2.13/go.mod h1:Q5FwaOKnCty3dVeVtki6DLwYa5vhNpOaeu1lwLyPCg8= bitbucket.org/ausocean/utils v1.2.11 h1:zA0FOaPjN960ryp8PKCkV5y50uWBYrIxCVnXjwbvPqg= bitbucket.org/ausocean/utils v1.2.11/go.mod h1:uXzX9z3PLemyURTMWRhVI8uLhPX4uuvaaO85v2hcob8= bitbucket.org/ausocean/utils v1.2.12 h1:VnskjWTDM475TnQRhBQE0cNp9D6Y6OELrd4UkD2VVIQ=