-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package logger | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/aripalo/vegas-credentials/internal/interfaces" | ||
"github.com/gookit/color" | ||
) | ||
|
||
// format the log message | ||
func format(a interfaces.AssumeCredentialProcess, colorize color.Color, emoji string, prefix string, message string) string { | ||
f := a.GetFlags() | ||
output := "" | ||
|
||
if emoji != "" && !f.NoColor { | ||
output = fmt.Sprintf("%s%s ", output, emoji) | ||
} | ||
|
||
if prefix != "" { | ||
var p string | ||
if f.NoColor { | ||
p = fmt.Sprintf("%s:", prefix) | ||
} else { | ||
p = colorize.Render(textBold.Render(fmt.Sprintf("%s:", prefix))) | ||
} | ||
output = fmt.Sprintf("%s%s ", output, p) | ||
} | ||
|
||
if f.NoColor { | ||
output = fmt.Sprintf("%s%s", output, message) | ||
} else { | ||
output = fmt.Sprintf("%s%s", output, colorize.Render(message)) | ||
} | ||
|
||
return output | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters