mirror of
				https://github.com/clearml/clearml
				synced 2025-06-26 18:16:07 +00:00 
			
		
		
		
	Removed colorama / coloredlogs, they are now optional packages dynamically loaded
This commit is contained in:
		
							parent
							
								
									c4c37c5cef
								
							
						
					
					
						commit
						d5a2383b75
					
				| @ -3,8 +3,6 @@ attrs>=18.0 | ||||
| backports.functools-lru-cache>=1.0.2 ; python_version < '3' | ||||
| boto3>=1.9 | ||||
| botocore>=1.12 | ||||
| colorama>=0.4.1 | ||||
| coloredlogs>=10.0 | ||||
| enum34>=0.9 ; python_version < '3.6' | ||||
| funcsigs>=1.0 | ||||
| furl>=2.0.0 | ||||
|  | ||||
| @ -6,9 +6,7 @@ import os | ||||
| import sys | ||||
| from platform import system | ||||
| 
 | ||||
| import colorama | ||||
| from ..config import config, get_log_redirect_level | ||||
| from coloredlogs import ColoredFormatter | ||||
| from pathlib2 import Path | ||||
| from six import BytesIO | ||||
| from tqdm import tqdm | ||||
| @ -34,11 +32,22 @@ class LoggerRoot(object): | ||||
|     def _make_stream_handler(cls, level=None, stream=sys.stdout, colored=False): | ||||
|         ch = logging.StreamHandler(stream=stream) | ||||
|         ch.setLevel(level) | ||||
|         formatter = None | ||||
| 
 | ||||
|         # if colored, try to import colorama & coloredlogs (by default, not in the requirements) | ||||
|         if colored: | ||||
|             colorama.init() | ||||
|             formatter = ColoredFormatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | ||||
|         else: | ||||
|             try: | ||||
|                 import colorama | ||||
|                 from coloredlogs import ColoredFormatter | ||||
|                 colorama.init() | ||||
|                 formatter = ColoredFormatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | ||||
|             except ImportError: | ||||
|                 colored = False | ||||
| 
 | ||||
|         # if we don't need or failed getting colored formatter | ||||
|         if not colored or not formatter: | ||||
|             formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | ||||
| 
 | ||||
|         ch.setFormatter(formatter) | ||||
|         return ch | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 allegroai
						allegroai