Skip to content

Commit 6a7d798

Browse files
committed
timestamps custom format
1 parent cc5c075 commit 6a7d798

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

backend/pkg/logger/data/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (sublogger *Logger) PushRecord(record abstraction.LoggerRecord) error {
110110
if !ok {
111111
filename := path.Join(
112112
"logger/data",
113-
fmt.Sprintf("data_%s", loggerHandler.Timestamp.Format(time.RFC3339)),
113+
fmt.Sprintf("data_%s_%s", timestamp.Format("YYYY_MM_DD_HH_mm_ss"), fmt.Sprint(timestamp.Nanosecond())),
114114
fmt.Sprintf("%s.csv", valueName),
115115
)
116116
err := os.MkdirAll(path.Dir(filename), os.ModePerm)

backend/pkg/logger/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type Logger struct {
2121
// An atomic boolean is used in order to use CompareAndSwap in the Start and Stop methods
2222
running *atomic.Bool
2323
subloggersLock *sync.RWMutex
24-
// The subloggers are only the loggers selected at the start of the log
24+
// The subloggers are only the logger s selected at the start of the log
2525
subloggers map[abstraction.LoggerName]abstraction.Logger
2626

2727
trace zerolog.Logger

backend/pkg/logger/order/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (sublogger *Logger) Start() error {
5353

5454
filename := path.Join(
5555
"logger/order",
56-
fmt.Sprintf("order_%s", logger.Timestamp.Format(time.RFC3339)),
56+
fmt.Sprintf("order_%s_%s", logger.Timestamp.Format("YYYY_MM_DD_HH_mm_ss"), fmt.Sprint(logger.Timestamp.Nanosecond())),
5757
"order.csv",
5858
)
5959
err := os.MkdirAll(path.Dir(filename), os.ModePerm)

backend/pkg/logger/protection/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (sublogger *Logger) PushRecord(record abstraction.LoggerRecord) error {
9292

9393
filename := path.Join(
9494
"logger/protections",
95-
fmt.Sprintf("protections_%s", logger.Timestamp.Format(time.RFC3339)),
95+
fmt.Sprintf("protection_%s_%s", logger.Timestamp.Format("YYYY_MM_DD_HH_mm_ss"), fmt.Sprint(logger.Timestamp.Nanosecond())),
9696
fmt.Sprintf("%s.csv", boardName),
9797
)
9898
err := os.MkdirAll(path.Dir(filename), os.ModePerm)

backend/pkg/logger/state/logger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func (sublogger *Logger) PushRecord(record abstraction.LoggerRecord) error {
6969

7070
filename := path.Join(
7171
"logger/state",
72-
fmt.Sprintf("state_%s", logger.Timestamp.Format(time.RFC3339)),
73-
fmt.Sprintf("state_%s.csv", time.Now().Format(time.RFC3339)),
72+
fmt.Sprintf("data_%s_%s", logger.Timestamp.Format("YYYY_MM_DD_HH_mm_ss"), fmt.Sprint(logger.Timestamp.Nanosecond())),
73+
fmt.Sprintf("state_%s_%s.csv", time.Now().Format("YYYY_MM_DD_HH_mm_ss"), fmt.Sprint(logger.Timestamp.Nanosecond())),
7474
)
7575
err := os.MkdirAll(path.Dir(filename), os.ModePerm)
7676
if err != nil {

0 commit comments

Comments
 (0)