File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ def __init__(
7878 secondary_log_colors : typing .Optional [SecondaryLogColors ] = None ,
7979 validate : bool = True ,
8080 stream : typing .Optional [typing .IO ] = None ,
81+ no_color : bool = False ,
8182 ) -> None :
8283 """
8384 Set the format and colors the ColoredFormatter will use.
@@ -122,6 +123,7 @@ def __init__(
122123 )
123124 self .reset = reset
124125 self .stream = stream
126+ self .no_color = no_color
125127
126128 def formatMessage (self , record : logging .LogRecord ) -> str :
127129 """Format a message from a record object."""
@@ -147,6 +149,9 @@ def _escape_code_map(self, item: str) -> EscapeCodes:
147149
148150 def _blank_escape_codes (self ):
149151 """Return True if we should be prevented from printing escape codes."""
152+ if self .no_color :
153+ return True
154+
150155 if "NO_COLOR" in os .environ :
151156 return True
152157
You can’t perform that action at this time.
0 commit comments