mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-30 00:09:07 +01:00
internal: add temporary debug log for state.Set value and caller
This commit is contained in:
@@ -2,7 +2,10 @@ package internal
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StatusType string
|
type StatusType string
|
||||||
@@ -52,6 +55,9 @@ func (c *contextState) SetOnChange(fn func()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *contextState) Set(update StatusType) {
|
func (c *contextState) Set(update StatusType) {
|
||||||
|
if _, file, line, ok := runtime.Caller(1); ok {
|
||||||
|
log.Infof("--- state.Set(%s) from %s:%d", update, file, line)
|
||||||
|
}
|
||||||
c.mutex.Lock()
|
c.mutex.Lock()
|
||||||
c.status = update
|
c.status = update
|
||||||
c.err = nil
|
c.err = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user