Skip to content

Commit

Permalink
change
Browse files Browse the repository at this point in the history
  • Loading branch information
chandrareddyp committed Jan 21, 2024
1 parent c909f93 commit ea457d0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions component/output_spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type OutputWriterSpinner interface {
StopSpinner()
// SetFinalText sets the spinner final text and prefix
// log indicator (log.LogTypeOUTPUT can be used for no prefix) if spinner is active
SetFinalText(finalText string, prefix log.LogTypeIndicator)
SetFinalText(finalText string, prefix log.LogType)
}

// outputwriterspinner is our internal implementation.
Expand Down Expand Up @@ -123,7 +123,7 @@ func (ows *outputwriterspinner) StopSpinner() {

// WithSpinnerFinalMsg sets the spinner final text and prefix log indicator
// (log.LogTypeOUTPUT can be used for no prefix)
func WithSpinnerFinalMsg(finalText string, prefix log.LogTypeIndicator) OutputWriterSpinnerOption {
func WithSpinnerFinalMsg(finalText string, prefix log.LogType) OutputWriterSpinnerOption {
finalText = fmt.Sprintf("%s%s", log.GetLogTypeIndicator(prefix), finalText)
return func(ows *outputwriterspinner) {
ows.spinnerFinalText = finalText
Expand All @@ -132,7 +132,7 @@ func WithSpinnerFinalMsg(finalText string, prefix log.LogTypeIndicator) OutputWr

// SetFinalText sets the spinner final text and prefix log indicator
// (log.LogTypeOUTPUT can be used for no prefix) if spinner is active
func (ows *outputwriterspinner) SetFinalText(finalText string, prefix log.LogTypeIndicator) {
func (ows *outputwriterspinner) SetFinalText(finalText string, prefix log.LogType) {
if ows.spinner != nil && ows.spinner.Active() {
finalText = fmt.Sprintf("%s%s", log.GetLogTypeIndicator(prefix), finalText)
ows.spinnerFinalText = finalText
Expand Down
2 changes: 1 addition & 1 deletion log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (l *logger) getLogString(values []interface{}) string {
}

func (l *logger) getLogTypeIndicator(logType string) string {
return GetLogTypeIndicator(LogTypeIndicator(logType))
return GetLogTypeIndicator(LogType(logType))
}

func copySlice(in []interface{}) []interface{} {
Expand Down
14 changes: 7 additions & 7 deletions log/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

package log

type LogTypeIndicator string
type LogType string

const (
LogTypeINFO LogTypeIndicator = "INFO"
LogTypeWARN LogTypeIndicator = "WARN"
LogTypeERROR LogTypeIndicator = "ERROR"
LogTypeSUCCESS LogTypeIndicator = "SUCCESS"
LogTypeOUTPUT LogTypeIndicator = "OUTPUT"
LogTypeINFO LogType = "INFO"
LogTypeWARN LogType = "WARN"
LogTypeERROR LogType = "ERROR"
LogTypeSUCCESS LogType = "SUCCESS"
LogTypeOUTPUT LogType = "OUTPUT"
)

func GetLogTypeIndicator(logType LogTypeIndicator) string {
func GetLogTypeIndicator(logType LogType) string {
switch logType {
case LogTypeINFO:
return "[i] "
Expand Down
2 changes: 1 addition & 1 deletion log/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (w *writer) Write(header, msg []byte, logEnabled bool, logVerbosity int32,

// If showTimestamp is set to true, log fullMsg with header
// If log type is OUTPUT skip the header
if w.showTimestamp && logType != string(LogTypeINFO) {
if w.showTimestamp && logType != string(LogTypeOUTPUT) {
msg = fullMsg
}

Expand Down

0 comments on commit ea457d0

Please sign in to comment.