Make the debug-log command more useful

The debug-log command now supports log level filtering and attribute
filtering. The log level filtering will only be able to set the minimum
log level as low as the server is configured to stream. If the server has
its log level set as INFO, then setting the log level in the CLI to DEBUG
will have no effect.

But anything above what the server sends, is within the control of the client
to filter. This is all done client side.

Attribute filters are useful if you need to watch the logs for a particular
worker, entity, etc.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-08-27 00:25:17 +00:00
parent e3a9fe7026
commit 0faeee703d
8 changed files with 343 additions and 38 deletions

View file

@ -143,20 +143,18 @@ func (c *Client) Write(msg []byte) (int, error) {
defer c.mux.Unlock()
if !c.running {
return 0, fmt.Errorf("client is stopped")
return 0, fmt.Errorf("websocket client is stopped")
}
tmp := make([]byte, len(msg))
copy(tmp, msg)
timer := time.NewTimer(5 * time.Second)
defer timer.Stop()
select {
case <-timer.C:
return 0, fmt.Errorf("timed out sending message to client")
case c.send <- tmp:
return len(tmp), nil
default:
return 0, fmt.Errorf("timed out sending message to websocket client")
}
return len(tmp), nil
}
// clientReader waits for options changes from the client. The client can at any time