Skip to content

Commit 42d9072

Browse files
committed
Refactor (v *InitJSON) Output to use defaults that come from the hclog package
1 parent b221cc0 commit 42d9072

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

internal/command/views/init.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
package views
55

66
import (
7-
"encoding/json"
87
"fmt"
98
"strings"
10-
"time"
119

1210
"github.com/hashicorp/terraform/internal/command/arguments"
1311
"github.com/hashicorp/terraform/internal/tfdiags"
@@ -97,18 +95,11 @@ func (v *InitJSON) Output(messageCode InitMessageCode, params ...any) {
9795
return
9896
}
9997

100-
current_timestamp := time.Now().UTC().Format(time.RFC3339)
101-
json_data := map[string]string{
102-
"@level": "info",
103-
"@message": preppedMessage,
104-
"@module": "terraform.ui",
105-
"@timestamp": current_timestamp,
106-
"type": "init_output",
107-
"message_code": string(messageCode),
108-
}
109-
110-
init_output, _ := json.Marshal(json_data)
111-
v.view.view.streams.Println(string(init_output))
98+
v.view.log.Info(
99+
preppedMessage,
100+
"type", "init_output", // Add "type":"init_output"
101+
"message_code", string(messageCode), // Add "message_code":"<value>"
102+
)
112103
}
113104

114105
func (v *InitJSON) LogInitMessage(messageCode InitMessageCode, params ...any) {

0 commit comments

Comments
 (0)