From 8e6ca6a978349fe8a869ffd602ea4f0d74c39cea Mon Sep 17 00:00:00 2001 From: Alexandr Dubovikov Date: Tue, 17 Oct 2023 11:55:31 +0200 Subject: [PATCH] added more debug --- publish/hep.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/publish/hep.go b/publish/hep.go index 5663c53..af55e6e 100644 --- a/publish/hep.go +++ b/publish/hep.go @@ -177,7 +177,7 @@ func (h *HEPOutputer) copyHEPFileOut(n int) (int, error) { if _, err := os.Stat(config.Cfg.HEPBufferFile); err != nil { logp.Debug("file doesn't exists: ", config.Cfg.HEPBufferFile) - return 0, fmt.Errorf("file doesn't exists") + return 0, fmt.Errorf("file doesn't exists: ", config.Cfg.HEPBufferFile) } HEPFileData, HEPFileDataerr := os.ReadFile(config.Cfg.HEPBufferFile) @@ -226,7 +226,8 @@ func (h *HEPOutputer) copyHEPbufftoFile(inbytes []byte) (int64, error) { destination, err := os.OpenFile(config.Cfg.HEPBufferFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666) if err != nil { - fmt.Println("Open HEP file error", err) + logp.Err("open HEP file error: %v\n", err) + return 0, fmt.Errorf("open HEP file error: %v", err) } defer destination.Close() @@ -247,7 +248,8 @@ func (h *HEPOutputer) copyHEPbufftoFile(inbytes []byte) (int64, error) { nBytes, err := destination.Write(inbytes) if err != nil { - logp.Debug("collector", "File Send HEP from buffer to file error", err) + logp.Err("file Send HEP from buffer to file error: %v", err.Error()) + return 0, fmt.Errorf("file Send HEP from buffer to file error: %v", err.Error()) } else { logp.Debug("collector", " File Send HEP from buffer to file OK") }