Documentation ¶
Index ¶
- Constants
- func Debug(ctx context.Context, subsystem LogSubsystem, msg string, ...)
- func Error(ctx context.Context, subsystem LogSubsystem, msg string, ...)
- func Info(ctx context.Context, subsystem LogSubsystem, msg string, ...)
- func LogAPICreateFailedAfterRetry(ctx context.Context, resourceType, resourceName, errorMsg string, ...)
- func LogAPICreateFailure(ctx context.Context, resourceType, errorMsg string, errorCode int)
- func LogAPICreateSuccess(ctx context.Context, resourceType, resourceID string)
- func LogAPIDeleteFailedAfterRetry(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, ...)
- func LogAPIDeleteFailureByID(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, ...)
- func LogAPIDeleteFailureByName(ctx context.Context, resourceType, resourceName, errorMsg string, ...)
- func LogAPIDeleteSuccess(ctx context.Context, resourceType, resourceID, resourceName string)
- func LogAPIReadFailedAfterRetry(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, ...)
- func LogAPIReadSuccess(ctx context.Context, resourceType, resourceID string)
- func LogAPIUpdateFailedAfterRetry(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, ...)
- func LogAPIUpdateFailureByID(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, ...)
- func LogAPIUpdateFailureByName(ctx context.Context, resourceType, resourceName, errorMsg string, ...)
- func LogAPIUpdateSuccess(ctx context.Context, resourceType, resourceID, resourceName string)
- func LogFailedReadByID(ctx context.Context, resourceType, resourceID, errorMsg string, errorCode int)
- func LogFailedReadByName(ctx context.Context, resourceType, resourceName, errorMsg string, ...)
- func LogTFConstructResourceFailure(ctx context.Context, resourceType, errorMsg string)
- func LogTFConstructResourceJSONMarshalFailure(ctx context.Context, resourceType, errorMsg string)
- func LogTFConstructResourceSuccess(ctx context.Context, resourceType string)
- func LogTFConstructResourceXMLMarshalFailure(ctx context.Context, resourceType, errorMsg string)
- func LogTFConstructedJSONResource(ctx context.Context, resourceType, jsonData string)
- func LogTFConstructedResource(ctx context.Context, resourceType string)
- func LogTFConstructedXMLResource(ctx context.Context, resourceType, xmlData string)
- func LogTFResourceDuplicateName(ctx context.Context, resourceType, resourceName string)
- func LogTFStateRemovalWarning(ctx context.Context, resourceType, resourceID string)
- func LogTFStateSyncFailedAfterRetry(ctx context.Context, resourceType, resourceID, errorMsg string)
- func LogTFStateSyncFailure(ctx context.Context, resourceType, errorMsg string)
- func LogTFStateSyncSuccess(ctx context.Context, resourceType, resourceID string)
- func LogTypeConversionFailure(ctx context.Context, ...)
- func MaskSensitiveData(ctx context.Context, subsystem LogSubsystem, expressions []*regexp.Regexp, ...) context.Context
- func MergeFields(subsystem LogSubsystem, additionalFields map[string]interface{}) map[string]interface{}
- func NewSubsystemLogger(ctx context.Context, subsystem LogSubsystem, level hclog.Level) context.Context
- func OmitLogs(ctx context.Context, subsystem LogSubsystem, keys []string, ...) context.Context
- func SetLogField(ctx context.Context, subsystem LogSubsystem, key string, value interface{}) context.Context
- func Warn(ctx context.Context, subsystem LogSubsystem, msg string, ...)
- type ConsoleLogger
- func (l *ConsoleLogger) Error(summary string, detail string, attributePath ...interface{})
- func (l *ConsoleLogger) Errorf(format string, args ...interface{})
- func (l *ConsoleLogger) Info(message string)
- func (l *ConsoleLogger) Infof(format string, args ...interface{})
- func (l *ConsoleLogger) Warn(summary string, detail string, attributePath ...interface{})
- func (l *ConsoleLogger) Warnf(format string, args ...interface{})
- type DiagnosticLogger
- type LogSubsystem
- type NullDiagnosticLogger
- func (NullDiagnosticLogger) Error(_ string, _ string, _ ...interface{})
- func (NullDiagnosticLogger) Errorf(_ string, _ ...interface{})
- func (NullDiagnosticLogger) Info(_ string)
- func (NullDiagnosticLogger) Infof(_ string, _ ...interface{})
- func (NullDiagnosticLogger) Warn(_ string, _ string, _ ...interface{})
- func (NullDiagnosticLogger) Warnf(_ string, _ ...interface{})
Constants ¶
const ( // TF Resource Construction MsgTFConstructResourceFailure = "failed to construct %s resource" MsgTFConstructResourceSuccess = "%s resource constructed successfully" MsgTooManyResourcesProvided = "too many resources provided, only 1 allowed, %v" // TF State MsgTFStateSyncFailure = "Failed to synchronize Terraform state for %s" MsgTFStateSyncSuccess = "Terraform state synchronized successfully for %s" MsgTFStateRemovalWarning = "Removing %s with ID: %s from Terraform state" // Jamf Pro MsgTFResourceDuplicateName = "A %s with the name '%s' already exists. %s names must be unique." // Create MsgAPICreateFailure = "API error occurred during %s creation" MsgAPICreateFailedAfterRetry = "Final attempt to create %s failed" MsgAPICreateSuccess = "%s created successfully though the API" // Read MsgAPIReadFailureByID = "API error occurred while reading %s with ID: %s" MsgAPIReadFailureByName = "API error occurred while reading %s with Name: %s" MsgAPIReadFailedAfterRetry = "Final attempt to read %s failed" MsgAPIReadSuccess = "%s with ID: %s successfully read from API" // Update MsgAPIUpdateFailureByID = "API error occurred while updating %s with ID: %s" MsgAPIUpdateFailureByName = "API error occurred while updating %s with Name: %s" MsgAPIUpdateFailedAfterRetry = "Final attempt to update %s failed" MsgAPIUpdateSuccess = "%s successfully updated in Terraform state" // Delete MsgAPIDeleteFailureByID = "API error occurred while deleting %s by ID" MsgAPIDeleteFailureByName = "API error occurred while deleting %s by name" MsgAPIDeleteFailedAfterRetry = "Final attempt to delete %s failed" MsgAPIDeleteSuccess = "%s successfully removed from Terraform state" // Others MsgTypeConversionFailure = "Failed to convert %s to %s for %s" )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(ctx context.Context, subsystem LogSubsystem, msg string, additionalFields map[string]interface{})
Debug logs a debug message with additional fields for a specific subsystem.
func Error ¶
func Error(ctx context.Context, subsystem LogSubsystem, msg string, additionalFields map[string]interface{})
Error logs an error message with additional fields for a specific subsystem.
func Info ¶
func Info(ctx context.Context, subsystem LogSubsystem, msg string, additionalFields map[string]interface{})
Info logs an info message with additional fields for a specific subsystem.
func LogAPICreateFailedAfterRetry ¶ added in v0.0.12
func LogAPICreateFailedAfterRetry(ctx context.Context, resourceType, resourceName, errorMsg string, errorCode int)
LogAPICreateFailedAfterRetryprovides structured logging for scenarios where update operation fails after retries
func LogAPICreateFailure ¶ added in v0.0.12
LogAPICreateFailure provides structured logging for API errors during creation
func LogAPICreateSuccess ¶ added in v0.0.12
LogAPICreateSuccess provides structured logging for successful resource creation
func LogAPIDeleteFailedAfterRetry ¶ added in v0.0.12
func LogAPIDeleteFailedAfterRetry(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, errorCode int)
LogAPIDeleteFailedAfterRetry provides structured logging for scenarios where delete operation fails after retries
func LogAPIDeleteFailureByID ¶ added in v0.0.12
func LogAPIDeleteFailureByID(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, errorCode int)
LogAPIDeleteFailureByID provides structured logging for errors when failing to delete by ID
func LogAPIDeleteFailureByName ¶ added in v0.0.12
func LogAPIDeleteFailureByName(ctx context.Context, resourceType, resourceName, errorMsg string, errorCode int)
LogAPIDeleteFailureByName provides structured logging for errors when failing to delete by Name
func LogAPIDeleteSuccess ¶ added in v0.0.12
LogAPIDeleteSuccess provides structured logging for successful delete operations
func LogAPIReadFailedAfterRetry ¶ added in v0.0.12
func LogAPIReadFailedAfterRetry(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, errorCode int)
LogAPIReadFailedAfterRetry provides structured logging for scenarios where update operation fails after retries
func LogAPIReadSuccess ¶ added in v0.0.12
LogAPIReadSuccess provides structured logging for successful read operations
func LogAPIUpdateFailedAfterRetry ¶ added in v0.0.12
func LogAPIUpdateFailedAfterRetry(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, errorCode int)
LogAPIUpdateFailedAfterRetry provides structured logging for scenarios where update operation fails after retries
func LogAPIUpdateFailureByID ¶ added in v0.0.12
func LogAPIUpdateFailureByID(ctx context.Context, resourceType, resourceID, resourceName, errorMsg string, errorCode int)
LogAPIUpdateFailureByID provides structured logging for errors when failing to update by ID
func LogAPIUpdateFailureByName ¶ added in v0.0.12
func LogAPIUpdateFailureByName(ctx context.Context, resourceType, resourceName, errorMsg string, errorCode int)
LogAPIUpdateFailureByName provides structured logging for errors when failing to update by Name
func LogAPIUpdateSuccess ¶ added in v0.0.12
LogAPIUpdateSuccess provides structured logging for successful update operations
func LogFailedReadByID ¶ added in v0.0.12
func LogFailedReadByID(ctx context.Context, resourceType, resourceID, errorMsg string, errorCode int)
LogFailedReadByID provides structured logging for errors when failing to read by ID
func LogFailedReadByName ¶ added in v0.0.12
func LogFailedReadByName(ctx context.Context, resourceType, resourceName, errorMsg string, errorCode int)
LogFailedReadByName provides structured logging for errors when failing to read by Name
func LogTFConstructResourceFailure ¶ added in v0.0.12
LogTFConstructResourceFailure provides structured logging for errors during object construction
func LogTFConstructResourceJSONMarshalFailure ¶ added in v0.0.12
LogTFConstructResourceJSONMarshalFailure provides structured logging for errors during marshaling of the resource object to JSON
func LogTFConstructResourceSuccess ¶ added in v0.0.12
LogTFConstructResourceSuccess provides structured logging for successful object construction
func LogTFConstructResourceXMLMarshalFailure ¶ added in v0.0.12
LogTFConstructResourceXMLMarshalFailure provides structured logging for errors during marshaling of the resource object to XML
func LogTFConstructedJSONResource ¶ added in v0.0.12
LogTFConstructedJSONResource provides structured logging for successful construction and serialization of the resource object to JSON
func LogTFConstructedResource ¶ added in v0.0.12
LogTFConstructedResource provides structured logging for successful object construction
func LogTFConstructedXMLResource ¶ added in v0.0.12
LogTFConstructResource provides structured logging for successful construction and serialization of the resource object to XML
func LogTFResourceDuplicateName ¶ added in v0.0.13
LogTFResourceDuplicateName provides structured logging for duplicate resource names
func LogTFStateRemovalWarning ¶ added in v0.0.12
LogWarnRemoveFromState logs a warning when a resource is being removed from the Terraform state
func LogTFStateSyncFailedAfterRetry ¶ added in v0.0.12
LogTFStateSyncFailedAfterRetry provides structured logging for scenarios where state synchronization fails after retries
func LogTFStateSyncFailure ¶ added in v0.0.12
LogTFStateSyncFailure provides structured logging for errors during Terraform state synchronization
func LogTFStateSyncSuccess ¶ added in v0.0.12
LogTFStateSyncSuccess provides structured logging for successful Terraform state synchronization
func LogTypeConversionFailure ¶ added in v0.0.13
func LogTypeConversionFailure(ctx context.Context, fromType, toType, resourceType, resourceID, errorMsg string)
LogTypeConversionFailure provides structured logging for errors during type conversion
func MaskSensitiveData ¶
func MaskSensitiveData(ctx context.Context, subsystem LogSubsystem, expressions []*regexp.Regexp, strings []string) context.Context
MaskSensitiveData masks sensitive data in logs based on regex patterns or strings for a specific subsystem.
func MergeFields ¶ added in v0.0.12
func MergeFields(subsystem LogSubsystem, additionalFields map[string]interface{}) map[string]interface{}
mergeFields merges subsystem info with additional fields.
func NewSubsystemLogger ¶
func NewSubsystemLogger(ctx context.Context, subsystem LogSubsystem, level hclog.Level) context.Context
NewSubsystemLogger creates a new logger for a specific subsystem with the provided log level.
func OmitLogs ¶
func OmitLogs(ctx context.Context, subsystem LogSubsystem, keys []string, expressions []*regexp.Regexp, strings []string) context.Context
OmitLogs omits logs containing specified keys or matching certain message patterns for a specific subsystem.
func SetLogField ¶
func SetLogField(ctx context.Context, subsystem LogSubsystem, key string, value interface{}) context.Context
SetLogField adds a field to all logs emitted from the provided context for a specific subsystem.
Types ¶
type ConsoleLogger ¶
type ConsoleLogger struct {
Diagnostics diag.Diagnostics
}
ConsoleLogger provides an implementation of the DiagnosticLogger interface. It logs messages to StdOut and creates diagnostics for errors and warnings.
func (*ConsoleLogger) Error ¶
func (l *ConsoleLogger) Error(summary string, detail string, attributePath ...interface{})
Error logs an error message and creates a diagnostic with Error severity.
func (*ConsoleLogger) Errorf ¶
func (l *ConsoleLogger) Errorf(format string, args ...interface{})
Errorf logs a formatted error message and creates a diagnostic with Error severity.
func (*ConsoleLogger) Info ¶
func (l *ConsoleLogger) Info(message string)
Info logs an informational message without creating a diagnostic.
func (*ConsoleLogger) Infof ¶
func (l *ConsoleLogger) Infof(format string, args ...interface{})
Infof logs a formatted informational message without creating a diagnostic.
func (*ConsoleLogger) Warn ¶
func (l *ConsoleLogger) Warn(summary string, detail string, attributePath ...interface{})
Warn logs a warning message and creates a diagnostic with Warning severity.
func (*ConsoleLogger) Warnf ¶
func (l *ConsoleLogger) Warnf(format string, args ...interface{})
Warnf logs a formatted warning message and creates a diagnostic with Warning severity.
type DiagnosticLogger ¶
type DiagnosticLogger interface { // Error logs an error message and creates a diagnostic with Error severity. Error(summary string, detail string, attributePath ...interface{}) // Errorf logs a formatted error message and creates a diagnostic with Error severity. Errorf(format string, args ...interface{}) // Warn logs a warning message and creates a diagnostic with Warning severity. Warn(summary string, detail string, attributePath ...interface{}) // Warnf logs a formatted warning message and creates a diagnostic with Warning severity. Warnf(format string, args ...interface{}) }
DiagnosticLogger is an interface for logging messages that can create diagnostics for errors and warnings.
type LogSubsystem ¶
type LogSubsystem string
LogSubsystem identifies different subsystems in your Terraform provider.
const ( SubsystemDelete LogSubsystem = "delete" SubsystemCreate LogSubsystem = "create" SubsystemRead LogSubsystem = "read" SubsystemUpdate LogSubsystem = "update" SubsystemSync LogSubsystem = "sync" // For synchronization operations SubsystemAPI LogSubsystem = "api" // For direct API interaction logs SubsystemRetry LogSubsystem = "retry" // For retry logic SubsystemValidation LogSubsystem = "validation" // For input validation SubsystemConfig LogSubsystem = "config" // For configuration-related logs SubsystemInit LogSubsystem = "init" // For provider initialization SubsystemCleanup LogSubsystem = "cleanup" // For cleanup operations SubsystemConstruct LogSubsystem = "construct" // For resource construction operations SubsystemGeneral LogSubsystem = "general" )
type NullDiagnosticLogger ¶
type NullDiagnosticLogger struct{}
NullDiagnosticLogger is an implementation of the DiagnosticLogger interface that disregards log output.
func (NullDiagnosticLogger) Error ¶
func (NullDiagnosticLogger) Error(_ string, _ string, _ ...interface{})
Error disregards the error log output.
func (NullDiagnosticLogger) Errorf ¶
func (NullDiagnosticLogger) Errorf(_ string, _ ...interface{})
Errorf disregards the formatted error log output.
func (NullDiagnosticLogger) Info ¶
func (NullDiagnosticLogger) Info(_ string)
Info disregards the informational log output.
func (NullDiagnosticLogger) Infof ¶
func (NullDiagnosticLogger) Infof(_ string, _ ...interface{})
Infof disregards the formatted informational log output.
func (NullDiagnosticLogger) Warn ¶
func (NullDiagnosticLogger) Warn(_ string, _ string, _ ...interface{})
Warn disregards the warning log output.
func (NullDiagnosticLogger) Warnf ¶
func (NullDiagnosticLogger) Warnf(_ string, _ ...interface{})
Warnf disregards the formatted warning log output.