Skip to content

Commit

Permalink
v3.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ddc committed Dec 30, 2024
1 parent 86d7a5a commit 1ee758e
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test, Build, Create a Release and Publish to PyPI
name: Test, Build, Release, Publish

on:
push:
Expand Down
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
# Logs
+ Parameters for all classes are declared as OPTIONAL
+ If any [.env](./ddcLogs/.env.example) variable is omitted, it falls back to default values here: [settings.py](ddcLogs/settings.py)
+ timezone parameter can also accept `localtime`, default to `UTC`
+ Function arguments will overwrite any env variable
+ Timezone parameter can also accept `localtime`, default to `UTC`
+ This parameter is only to display the timezone datetime inside the log file
+ For timed rotation, only UTC and localtime are supported, meaning it will rotate at UTC or localtime
+ env variable to change between UTC and localtime is `LOG_ROTATE_AT_UTC` and default to True
+ streamhandler parameter will add stream handler along with file handler
+ showlocation parameter will show the filename and the line number where the message originated
+ Streamhandler parameter will add stream handler along with file handler
+ Showlocation parameter will show the filename and the line number where the message originated



Expand All @@ -39,8 +40,6 @@ from ddcLogs import BasicLog
logger = BasicLog(
level="debug",
name="app",
encoding="UTF-8",
datefmt="%Y-%m-%dT%H:%M:%S",
timezone="America/Sao_Paulo",
showlocation=False,
).init()
Expand All @@ -67,8 +66,6 @@ logger = SizeRotatingLog(
filenames=["main.log", "app1.log"],
maxmbytes=5,
daystokeep=7,
encoding="UTF-8",
datefmt="%Y-%m-%dT%H:%M:%S",
timezone="America/Chicago",
streamhandler=True,
showlocation=False
Expand Down Expand Up @@ -98,10 +95,7 @@ logger = TimedRotatingLog(
directory="/app/logs",
filenames=["main.log", "app2.log"],
when="midnight",
sufix="%Y%m%d",
daystokeep=7,
encoding="UTF-8",
datefmt="%Y-%m-%dT%H:%M:%S",
timezone="UTC",
streamhandler=True,
showlocation=False
Expand All @@ -115,7 +109,7 @@ logger.warning("This is a warning example")



## Env Variables
## Env Variables (Optional)
```
LOG_LEVEL=DEBUG
LOG_TIMEZONE=America/Chicago
Expand All @@ -134,7 +128,6 @@ LOG_MAX_FILE_SIZE_MB=10
# TimedRotatingLog
LOG_ROTATE_WHEN=midnight
LOG_ROTATE_AT_UTC=True
LOG_ROTATE_FILE_SUFIX=%Y%m%d
```


Expand Down
1 change: 0 additions & 1 deletion ddcLogs/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ LOG_MAX_FILE_SIZE_MB=10
# TimedRotatingLog
LOG_ROTATE_WHEN=midnight
LOG_ROTATE_AT_UTC=True
LOG_ROTATE_FILE_SUFIX=%Y%m%d
Loading

0 comments on commit 1ee758e

Please sign in to comment.