-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: closes #30 move StepLogger to deployment domain
- Loading branch information
Showing
9 changed files
with
67 additions
and
76 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
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
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
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
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,37 @@ | ||
package infra | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
|
||
"github.com/YuukanOO/seelf/internal/deployment/domain" | ||
) | ||
|
||
type stepLogger struct { | ||
writer io.Writer | ||
} | ||
|
||
// Instantiates a new step logger to provide a simple way to build a deployment logfile. | ||
func NewStepLogger(writer io.Writer) domain.StepLogger { | ||
return &stepLogger{writer} | ||
} | ||
|
||
func (l *stepLogger) Stepf(format string, args ...any) { | ||
l.print("[STEP]", format, args) | ||
} | ||
|
||
func (l *stepLogger) Warnf(format string, args ...any) { | ||
l.print("[WARN]", format, args) | ||
} | ||
|
||
func (l *stepLogger) Infof(format string, args ...any) { | ||
l.print("[INFO]", format, args) | ||
} | ||
|
||
func (l *stepLogger) Error(err error) { | ||
l.print("[ERROR]", err.Error(), nil) | ||
} | ||
|
||
func (l *stepLogger) print(prefix string, format string, args []any) { | ||
l.writer.Write([]byte(fmt.Sprintf("%s %s\n", prefix, fmt.Sprintf(format, args...)))) | ||
} |
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
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
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
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