forked from AUTOMATIC1111/stable-diffusion-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warning when meet emb name conflicting
Choose standalone embedding (in /embeddings folder) first
- Loading branch information
1 parent
2282eb8
commit 81e94de
Showing
2 changed files
with
81 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import sys | ||
import copy | ||
import logging | ||
|
||
|
||
class ColoredFormatter(logging.Formatter): | ||
COLORS = { | ||
"DEBUG": "\033[0;36m", # CYAN | ||
"INFO": "\033[0;32m", # GREEN | ||
"WARNING": "\033[0;33m", # YELLOW | ||
"ERROR": "\033[0;31m", # RED | ||
"CRITICAL": "\033[0;37;41m", # WHITE ON RED | ||
"RESET": "\033[0m", # RESET COLOR | ||
} | ||
|
||
def format(self, record): | ||
colored_record = copy.copy(record) | ||
levelname = colored_record.levelname | ||
seq = self.COLORS.get(levelname, self.COLORS["RESET"]) | ||
colored_record.levelname = f"{seq}{levelname}{self.COLORS['RESET']}" | ||
return super().format(colored_record) | ||
|
||
|
||
logger = logging.getLogger("lora") | ||
logger.propagate = False | ||
|
||
|
||
if not logger.handlers: | ||
handler = logging.StreamHandler(sys.stdout) | ||
handler.setFormatter( | ||
ColoredFormatter("[%(name)s]-%(levelname)s: %(message)s") | ||
) | ||
logger.addHandler(handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters