Skip to content

Commit

Permalink
Let --verbose have an argument for the log level.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Oct 4, 2024
1 parent d854ed0 commit 6f021d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ def get_logs():
return "\n".join([formatter.format(x) for x in logs])


def setup_logger(verbose: bool = False, capacity: int = 300):
def setup_logger(log_level: str = 'INFO', capacity: int = 300):
global logs
if logs:
return

# Setup default global logger
logger = logging.getLogger()
logger.setLevel(logging.DEBUG if verbose else logging.INFO)
logger.setLevel(log_level)

stream_handler = logging.StreamHandler()
stream_handler.setFormatter(logging.Formatter("%(message)s"))
Expand Down
2 changes: 1 addition & 1 deletion comfy/cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class LatentPreviewMethod(enum.Enum):

parser.add_argument("--multi-user", action="store_true", help="Enables per-user storage.")

parser.add_argument("--verbose", action="store_true", help="Enables more debug prints.")
parser.add_argument("--verbose", default='INFO', const='DEBUG', nargs="?", choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], help='Set the logging level')

# The default built-in provider hosted under web/
DEFAULT_VERSION_STRING = "comfyanonymous/ComfyUI@latest"
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from app.logger import setup_logger


setup_logger(verbose=args.verbose)
setup_logger(log_level=args.verbose)


def execute_prestartup_script():
Expand Down

0 comments on commit 6f021d8

Please sign in to comment.