diff --git a/artifactory/services/repositories.go b/artifactory/services/repositories.go index b8b71d0e4..dd3b628fe 100644 --- a/artifactory/services/repositories.go +++ b/artifactory/services/repositories.go @@ -62,7 +62,7 @@ func (rs *RepositoriesService) GetWithFilter(params RepositoriesFilterParams) (* // This function is used to create the URL for the repositories API with the given filter params. // The function expects to get a RepositoriesFilterParams struct that contains the desired filter params. // The function returns the URL string. -func (rs *RepositoriesService)createUrlWithFilter(params RepositoriesFilterParams) string { +func (rs *RepositoriesService) createUrlWithFilter(params RepositoriesFilterParams) string { u := url.URL{ Path: apiRepositories, } diff --git a/utils/log/logger.go b/utils/log/logger.go index f3c1f1c35..53a02c170 100644 --- a/utils/log/logger.go +++ b/utils/log/logger.go @@ -62,12 +62,13 @@ func NewLogger(logLevel LevelType, logToWriter io.Writer) *jfrogLogger { } type jfrogLogger struct { - LogLevel LevelType - OutputLog *log.Logger - DebugLog *log.Logger - InfoLog *log.Logger - WarnLog *log.Logger - ErrorLog *log.Logger + LogLevel LevelType + AllowEmojis bool + OutputLog *log.Logger + DebugLog *log.Logger + InfoLog *log.Logger + WarnLog *log.Logger + ErrorLog *log.Logger } func SetLogger(newLogger Log) { @@ -96,6 +97,10 @@ func (logger *jfrogLogger) SetOutputWriter(writer io.Writer) { logger.OutputLog = log.New(outputWriter, "", 0) } +func (logger *jfrogLogger) SetAllowEmojis(allow bool) { + logger.AllowEmojis = allow +} + // Set the logs' writer to Stderr unless an alternative one is provided. // In case the writer is set for file, colors will not be in use. // Log flags to modify the log prefix as described in https://pkg.go.dev/log#pkg-constants. @@ -189,11 +194,13 @@ func (logger jfrogLogger) Output(a ...interface{}) { } func (logger *jfrogLogger) Println(log *log.Logger, isTerminal bool, values ...interface{}) { - // Remove emojis from all strings if it's not a terminal or if the terminal is not supporting colors + // If not requested, remove emojis from all strings if it's not a terminal or if the terminal is not supporting colors if !(IsColorsSupported() && isTerminal) { for i, value := range values { if str, ok := value.(string); ok { - if gomoji.ContainsEmoji(str) { + if logger.AllowEmojis { + values[i] = str + } else if gomoji.ContainsEmoji(str) { values[i] = gomoji.RemoveEmojis(str) } }