clean up get_logger() call

This commit is contained in:
Lincoln Stein 2023-12-04 22:41:59 -05:00
parent bdb0d13a2d
commit 3c7d1fcd32
2 changed files with 4 additions and 4 deletions

View File

@ -141,7 +141,7 @@ async def del_model_record(
status_code=201, status_code=201,
) )
async def add_model_record( async def add_model_record(
config: Annotated[AnyModelConfig, Body(description="Model config", discriminator="type")] config: Annotated[AnyModelConfig, Body(description="Model config", discriminator="type")],
) -> AnyModelConfig: ) -> AnyModelConfig:
""" """
Add a model using the configuration information appropriate for its type. Add a model using the configuration information appropriate for its type.

View File

@ -343,12 +343,12 @@ class InvokeAILogger(object): # noqa D102
) -> logging.Logger: # noqa D102 ) -> logging.Logger: # noqa D102
if name in cls.loggers: if name in cls.loggers:
return cls.loggers[name] return cls.loggers[name]
else:
logger = logging.getLogger(name) logger = logging.getLogger(name)
logger.setLevel(config.log_level.upper()) # yes, strings work here logger.setLevel(config.log_level.upper()) # yes, strings work here
for ch in cls.get_loggers(config): for ch in cls.get_loggers(config):
logger.addHandler(ch) logger.addHandler(ch)
cls.loggers[name] = logger cls.loggers[name] = logger
return cls.loggers[name] return cls.loggers[name]
@classmethod @classmethod