diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 849f986b3dd629d679a8fbff9a7e55d646a9691a..8b1e5fe0159d142dde260de0ac3d17ea744014b6 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -429,7 +429,9 @@ void ast_callid_strnprint(char *buffer, size_t buffer_size, ast_callid callid);
 
 #define DEBUG_ATLEAST(level) \
 	(option_debug >= (level) \
-		|| (ast_opt_dbg_module && (int)ast_debug_get_by_module(AST_MODULE) >= (level)))
+		|| (ast_opt_dbg_module \
+        	&& ((int)ast_debug_get_by_module(AST_MODULE) >= (level) \
+				|| (int)ast_debug_get_by_module(__FILE__) >= (level))))
 
 /*!
  * \brief Log a DEBUG message