Add details to log (#35)
Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
parent
f8c9e4c0af
commit
cb26399be6
1 changed files with 2 additions and 2 deletions
|
|
@ -51,12 +51,12 @@ func DiagsToError(diags diag.Diagnostics) error {
|
||||||
|
|
||||||
// LogAndAddError Logs the error and adds it to the diags
|
// LogAndAddError Logs the error and adds it to the diags
|
||||||
func LogAndAddError(ctx context.Context, diags *diag.Diagnostics, summary, detail string) {
|
func LogAndAddError(ctx context.Context, diags *diag.Diagnostics, summary, detail string) {
|
||||||
tflog.Error(ctx, summary)
|
tflog.Error(ctx, fmt.Sprintf("%s | %s", summary, detail))
|
||||||
diags.AddError(summary, detail)
|
diags.AddError(summary, detail)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogAndAddWarning Logs the warning and adds it to the diags
|
// LogAndAddWarning Logs the warning and adds it to the diags
|
||||||
func LogAndAddWarning(ctx context.Context, diags *diag.Diagnostics, summary, detail string) {
|
func LogAndAddWarning(ctx context.Context, diags *diag.Diagnostics, summary, detail string) {
|
||||||
tflog.Warn(ctx, summary)
|
tflog.Warn(ctx, fmt.Sprintf("%s | %s", summary, detail))
|
||||||
diags.AddWarning(summary, detail)
|
diags.AddWarning(summary, detail)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue