-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathframework.go
More file actions
43 lines (34 loc) · 1.61 KB
/
framework.go
File metadata and controls
43 lines (34 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright IBM Corp. 2021, 2025
// SPDX-License-Identifier: MPL-2.0
package logging
import (
"context"
"github.com/hashicorp/terraform-plugin-log/tfsdklog"
)
const (
// SubsystemFramework is the tfsdklog subsystem name for framework.
SubsystemFramework = "framework"
)
// FrameworkDebug emits a framework subsystem log at DEBUG level.
func FrameworkDebug(ctx context.Context, msg string, additionalFields ...map[string]interface{}) {
tfsdklog.SubsystemDebug(ctx, SubsystemFramework, msg, additionalFields...)
}
// FrameworkError emits a framework subsystem log at ERROR level.
func FrameworkError(ctx context.Context, msg string, additionalFields ...map[string]interface{}) {
tfsdklog.SubsystemError(ctx, SubsystemFramework, msg, additionalFields...)
}
// FrameworkTrace emits a framework subsystem log at TRACE level.
func FrameworkTrace(ctx context.Context, msg string, additionalFields ...map[string]interface{}) {
tfsdklog.SubsystemTrace(ctx, SubsystemFramework, msg, additionalFields...)
}
// FrameworkWarn emits a framework subsystem log at WARN level.
func FrameworkWarn(ctx context.Context, msg string, additionalFields ...map[string]interface{}) {
tfsdklog.SubsystemWarn(ctx, SubsystemFramework, msg, additionalFields...)
}
// FrameworkWithAttributePath returns a new Context with KeyAttributePath set.
// The attribute path is expected to be string, so the logging package does not
// need to import path handling code.
func FrameworkWithAttributePath(ctx context.Context, attributePath string) context.Context {
ctx = tfsdklog.SubsystemSetField(ctx, SubsystemFramework, KeyAttributePath, attributePath)
return ctx
}