diff --git a/integrations/datadogunifi/logger.go b/integrations/datadogunifi/logger.go index 29801bc5..eddf5313 100644 --- a/integrations/datadogunifi/logger.go +++ b/integrations/datadogunifi/logger.go @@ -2,15 +2,21 @@ package datadogunifi // Logf logs a message. func (u *DatadogUnifi) Logf(msg string, v ...interface{}) { - u.Collector.Logf(msg, v...) + if u.Collector != nil { + u.Collector.Logf(msg, v...) + } } // LogErrorf logs an error message. func (u *DatadogUnifi) LogErrorf(msg string, v ...interface{}) { - u.Collector.LogErrorf(msg, v...) + if u.Collector != nil { + u.Collector.LogErrorf(msg, v...) + } } // LogDebugf logs a debug message. func (u *DatadogUnifi) LogDebugf(msg string, v ...interface{}) { - u.Collector.LogDebugf(msg, v...) + if u.Collector != nil { + u.Collector.LogDebugf(msg, v...) + } }