diff --git a/core/interfaces/logger.go b/core/interfaces/logger.go index dce1ee6d..d8a92486 100644 --- a/core/interfaces/logger.go +++ b/core/interfaces/logger.go @@ -13,4 +13,7 @@ type Logger interface { // Errorf logs a formatted error message. Errorf(format string, args ...interface{}) + + // Fatalf logs a formatted fatal message. + Fatalf(format string, args ...interface{}) } diff --git a/core/utils/log.go b/core/utils/log.go index babda4ac..8852897b 100644 --- a/core/utils/log.go +++ b/core/utils/log.go @@ -37,6 +37,11 @@ func (l *ServiceLogger) Debugf(format string, args ...interface{}) { log.Debugf(l.getFormat(format), args...) } +// Fatalf logs a fatal message with formatted content and exits the program. +func (l *ServiceLogger) Fatalf(format string, args ...interface{}) { + log.Fatalf(l.getFormat(format), args...) +} + func (l *ServiceLogger) getFormat(format string) string { return fmt.Sprintf("[%s] %s", l.prefix, format) }