@@ -16,6 +16,13 @@ class LoggingSettings(BaseModel):
1616 syslog_host : Optional [str ] = None
1717 syslog_port : Optional [int ] = None
1818
19+ def __init__ (self , ** data ):
20+ super ().__init__ (** data )
21+ if isinstance (self .file_path , str ):
22+ self .file_path = Path (self .file_path )
23+ if isinstance (self .file_path , Path ):
24+ self .file_path .mkdir (parents = True , exist_ok = True )
25+
1926
2027class ColoredFormatter (logging .Formatter ):
2128 def __init__ (self , fmt = None , datefmt = None , style = "%" ):
@@ -39,6 +46,7 @@ def format(self, record):
3946 record .name = self ._name_color_format .format (record .name )
4047 return super (ColoredFormatter , self ).format (record ) + self .splitter
4148
49+
4250class IgnoreNANTraceFormatter (ColoredFormatter ):
4351 def format (self , record ):
4452 try :
@@ -47,6 +55,7 @@ def format(self, record):
4755 except Exception :
4856 return record .getMessage ()
4957
58+
5059class SysLogFormatter (ColoredFormatter ):
5160 def format (self , record ):
5261 try :
@@ -64,6 +73,3 @@ def __init__(self, application_level):
6473 def filter (self , record ):
6574 record .application_level = self .application_level
6675 return True
67-
68-
69-
0 commit comments