diff --git a/lib/bb/msg.py b/lib/bb/msg.py
index 4f616ff42e7..02728c44bba 100644
--- a/lib/bb/msg.py
+++ b/lib/bb/msg.py
@@ -102,6 +102,14 @@ class BBLogFormatter(logging.Formatter):
     def enable_color(self):
         self.color_enabled = True
 
+    def set_warn_color_red(self):
+        """
+        Changes the warning messages color to red. Should be
+        used when treating warnings as errors.
+        """
+        self.COLORS[self.WARNING] = self.RED
+        self.COLORS[self.WARNONCE] = self.RED
+
     def __repr__(self):
         return "%s fmt='%s' color=%s" % (self.__class__.__name__, self._fmt, "True" if self.color_enabled else "False")
 
