refactor: replace Unix socket log communication with HTTP-based system

Replace the legacy Unix socket log communication between `ctrld start` and
`ctrld run` with a modern HTTP-based system for better reliability and
maintainability.

Benefits:
- More reliable communication protocol using standard HTTP
- Better error handling and connection management
- Cleaner separation of concerns with dedicated endpoints
- Easier to test and debug with HTTP-based communication
- More maintainable code with proper abstraction layers

This change maintains backward compatibility while providing a more robust
foundation for inter-process communication between ctrld commands.
This commit is contained in:
Cuong Manh Le
2025-09-12 18:22:02 +07:00
committed by Cuong Manh Le
parent a04babbbc3
commit 56f8113bb0
7 changed files with 976 additions and 137 deletions
+3 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"os"
"time"
"go.uber.org/zap"
@@ -244,7 +245,8 @@ func (l *Logger) GetLogger() *Logger {
// Write implements io.Writer to allow direct writing to the logger
func (l *Logger) Write(p []byte) (n int, err error) {
l.Info().Msg(string(p))
stdoutSyncer := zapcore.AddSync(os.Stdout)
stdoutSyncer.Write(p)
return len(p), nil
}