Skip to content

Commit

Permalink
Merge pull request #39 from codecrafters-io/revert-logger-update
Browse files Browse the repository at this point in the history
Revert interface changes to logger wrt secondaryPrefix
  • Loading branch information
ryan-gang committed Jul 5, 2024
2 parents 4bb9a74 + 34e3b88 commit 272d2ed
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,16 @@ func GetLogger(isDebug bool, prefix string) *Logger {
}

func (l *Logger) UpdateSecondaryPrefix(prefix string) {
// Pass in the actual prefix that will be used.
// Else, if we want to use a series of [prefix1][prefix2] that fails
l.secondaryPrefix = prefix
if prefix == "" {
// Reset the prefix to the original one.
l.logger.SetPrefix(yellowColorize(l.prefix)[0])
} else {
// Append the secondary prefix to the original one.
l.logger.SetPrefix(yellowColorize(l.prefix + prefix)[0])
l.logger.SetPrefix(yellowColorize(l.prefix + fmt.Sprintf("[%s] ", prefix))[0])
}
}

func (l *Logger) GetSecondaryPrefix() string {
return l.secondaryPrefix
}

func (l *Logger) ResetSecondaryPrefix() {
l.UpdateSecondaryPrefix("")
}
Expand Down

0 comments on commit 272d2ed

Please sign in to comment.