1414# Logs
1515+ Parameters for all classes are declared as OPTIONAL
1616+ If any [ .env] ( ./ddcLogs/.env.example ) variable is omitted, it falls back to default values here: [ settings.py] ( ddcLogs/settings.py )
17- + timezone parameter can also accept ` localtime ` , default to ` UTC `
17+ + Function arguments will overwrite any env variable
18+ + Timezone parameter can also accept ` localtime ` , default to ` UTC `
1819 + This parameter is only to display the timezone datetime inside the log file
1920 + For timed rotation, only UTC and localtime are supported, meaning it will rotate at UTC or localtime
2021 + env variable to change between UTC and localtime is ` LOG_ROTATE_AT_UTC ` and default to True
21- + streamhandler parameter will add stream handler along with file handler
22- + showlocation parameter will show the filename and the line number where the message originated
22+ + Streamhandler parameter will add stream handler along with file handler
23+ + Showlocation parameter will show the filename and the line number where the message originated
2324
2425
2526
@@ -39,8 +40,6 @@ from ddcLogs import BasicLog
3940logger = BasicLog(
4041 level = " debug" ,
4142 name = " app" ,
42- encoding = " UTF-8" ,
43- datefmt = " %Y-%m-%d T%H:%M:%S" ,
4443 timezone = " America/Sao_Paulo" ,
4544 showlocation = False ,
4645).init()
@@ -67,8 +66,6 @@ logger = SizeRotatingLog(
6766 filenames = [" main.log" , " app1.log" ],
6867 maxmbytes = 5 ,
6968 daystokeep = 7 ,
70- encoding = " UTF-8" ,
71- datefmt = " %Y-%m-%d T%H:%M:%S" ,
7269 timezone = " America/Chicago" ,
7370 streamhandler = True ,
7471 showlocation = False
@@ -98,10 +95,7 @@ logger = TimedRotatingLog(
9895 directory = " /app/logs" ,
9996 filenames = [" main.log" , " app2.log" ],
10097 when = " midnight" ,
101- sufix = " %Y%m%d " ,
10298 daystokeep = 7 ,
103- encoding = " UTF-8" ,
104- datefmt = " %Y-%m-%d T%H:%M:%S" ,
10599 timezone = " UTC" ,
106100 streamhandler = True ,
107101 showlocation = False
@@ -115,7 +109,7 @@ logger.warning("This is a warning example")
115109
116110
117111
118- ## Env Variables
112+ ## Env Variables (Optional)
119113```
120114LOG_LEVEL=DEBUG
121115LOG_TIMEZONE=America/Chicago
@@ -134,7 +128,6 @@ LOG_MAX_FILE_SIZE_MB=10
134128# TimedRotatingLog
135129LOG_ROTATE_WHEN=midnight
136130LOG_ROTATE_AT_UTC=True
137- LOG_ROTATE_FILE_SUFIX=%Y%m%d
138131```
139132
140133
0 commit comments