-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathprovider.go
More file actions
30 lines (26 loc) · 835 Bytes
/
provider.go
File metadata and controls
30 lines (26 loc) · 835 Bytes
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
package loggertest
import (
"context"
"io"
"github.com/hashicorp/terraform-plugin-log/internal/logging"
"github.com/hashicorp/terraform-plugin-log/tfsdklog"
)
func ProviderRoot(ctx context.Context, output io.Writer) context.Context {
return tfsdklog.NewRootProviderLogger(
ctx,
logging.WithoutLocation(),
logging.WithoutTimestamp(),
logging.WithOutput(output),
)
}
// ProviderRootWithLocation is for testing code that affects go-hclog's caller
// information (location offset). Most testing code should avoid this, since
// correctly checking differences including the location is extra effort
// with little benefit.
func ProviderRootWithLocation(ctx context.Context, output io.Writer) context.Context {
return tfsdklog.NewRootProviderLogger(
ctx,
logging.WithoutTimestamp(),
logging.WithOutput(output),
)
}