]> code.octet-stream.net Git - broadcaster/commitdiff
Clean up log entries
authorThomas Karpiniec <tom.karpiniec@outlook.com>
Mon, 28 Oct 2024 10:20:58 +0000 (21:20 +1100)
committerThomas Karpiniec <tom.karpiniec@outlook.com>
Mon, 28 Oct 2024 10:20:58 +0000 (21:20 +1100)
radio/main.go
server/files.go
server/main.go
server/radio_sync.go
server/session.go

index 6e317721235654db46d291980588cd5c511252a7..eab957a9bbb5669f20f6aaa9687e9b4bde73be79 100644 (file)
@@ -55,7 +55,7 @@ func main() {
        signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
        go func() {
                sig := <-sig
        signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
        go func() {
                sig := <-sig
-               log.Println("Radio shutting down due to signal", sig)
+               log.Println("Radio shutting down due to signal:", sig)
                // Make sure we always stop PTT when program ends
                ptt.DisengagePTT()
                os.Exit(0)
                // Make sure we always stop PTT when program ends
                ptt.DisengagePTT()
                os.Exit(0)
index b452997ef8248312f4ac139942cbddcd9f57354c..963be99024ab917bde1762e65ffd12395e3922de 100644 (file)
@@ -27,15 +27,13 @@ var files AudioFiles
 func InitAudioFiles(path string) {
        files.changeWait = make(chan bool)
        files.path = path
 func InitAudioFiles(path string) {
        files.changeWait = make(chan bool)
        files.path = path
-       log.Println("initing audio files")
        files.Refresh()
        files.Refresh()
-       log.Println("done")
 }
 
 func (r *AudioFiles) Refresh() {
        entries, err := os.ReadDir(r.path)
        if err != nil {
 }
 
 func (r *AudioFiles) Refresh() {
        entries, err := os.ReadDir(r.path)
        if err != nil {
-               log.Println("couldn't read dir", r.path)
+               log.Println("Couldn't read dir", r.path)
                return
        }
        r.filesMutex.Lock()
                return
        }
        r.filesMutex.Lock()
@@ -44,7 +42,7 @@ func (r *AudioFiles) Refresh() {
        for _, file := range entries {
                f, err := os.Open(filepath.Join(r.path, file.Name()))
                if err != nil {
        for _, file := range entries {
                f, err := os.Open(filepath.Join(r.path, file.Name()))
                if err != nil {
-                       log.Println("couldn't open", file.Name())
+                       log.Println("Couldn't open", file.Name())
                        return
                }
                hash := sha256.New()
                        return
                }
                hash := sha256.New()
index 69d1ca70ddba349a6611255a5d1e4f0ae1e9e868..9f6927e9e63850ef8550e02e6b5fb29082c5dec6 100644 (file)
@@ -413,7 +413,7 @@ func changePasswordPage(w http.ResponseWriter, r *http.Request, user User) {
                        data.ShowForm = false
                        cookie, err := r.Cookie("broadcast_session")
                        if err == nil {
                        data.ShowForm = false
                        cookie, err := r.Cookie("broadcast_session")
                        if err == nil {
-                               log.Println("clearing other sessions for username", user.Username, "token", cookie.Value)
+                               log.Println("Clearing other sessions for username", user.Username, "token", cookie.Value)
                                db.ClearOtherSessions(user.Username, cookie.Value)
                        }
                }
                                db.ClearOtherSessions(user.Username, cookie.Value)
                        }
                }
@@ -642,7 +642,6 @@ func filesPage(w http.ResponseWriter, _ *http.Request, user User) {
        data := FilesPageData{
                Files: files.Files(),
        }
        data := FilesPageData{
                Files: files.Files(),
        }
-       log.Println("file page data", data)
        tmpl := template.Must(template.ParseFS(content, "templates/files.html"))
        err := tmpl.Execute(w, data)
        if err != nil {
        tmpl := template.Must(template.ParseFS(content, "templates/files.html"))
        err := tmpl.Execute(w, data)
        if err != nil {
@@ -671,7 +670,7 @@ func uploadFile(w http.ResponseWriter, r *http.Request) {
                f, _ := os.Create(path)
                defer f.Close()
                io.Copy(f, file)
                f, _ := os.Create(path)
                defer f.Close()
                io.Copy(f, file)
-               log.Println("uploaded file to", path)
+               log.Println("Uploaded file to", path)
                files.Refresh()
        }
        http.Redirect(w, r, "/files/", http.StatusFound)
                files.Refresh()
        }
        http.Redirect(w, r, "/files/", http.StatusFound)
index 66521f8b5a132b304519cb0cce835e5d8241c53a..6eefc8b2785fe7fbd96c720e001dad714b8c6f65 100644 (file)
@@ -8,7 +8,7 @@ import (
 )
 
 func RadioSync(ws *websocket.Conn) {
 )
 
 func RadioSync(ws *websocket.Conn) {
-       log.Println("A websocket connected, I think")
+       log.Println("Radio websocket connected, not yet authenticated")
        buf := make([]byte, 16384)
 
        badRead := false
        buf := make([]byte, 16384)
 
        badRead := false
index a097989a774248ec405b4c95f88415cf22196215..1ec3348f7a342b0d0bfdcab4c9403574415b82e2 100644 (file)
@@ -28,7 +28,6 @@ func currentUser(_ http.ResponseWriter, r *http.Request) (User, error) {
 
 func createSessionCookie(w http.ResponseWriter, username string) {
        sess := generateSession()
 
 func createSessionCookie(w http.ResponseWriter, username string) {
        sess := generateSession()
-       log.Println("Generated a random session", sess)
        expiration := time.Now().Add(365 * 24 * time.Hour)
        cookie := http.Cookie{Name: "broadcast_session", Value: sess, Expires: expiration, SameSite: http.SameSiteLaxMode}
        db.InsertSession(username, sess, expiration)
        expiration := time.Now().Add(365 * 24 * time.Hour)
        cookie := http.Cookie{Name: "broadcast_session", Value: sess, Expires: expiration, SameSite: http.SameSiteLaxMode}
        db.InsertSession(username, sess, expiration)