mirror of
https://git.juggalol.com/agatha/gitmon.git
synced 2024-11-22 07:26:41 +00:00
Add custom log levels. Closes #1
This commit is contained in:
parent
bf34654a46
commit
73e5a63565
@ -2,6 +2,9 @@
|
|||||||
import sys
|
import sys
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
logger.level('CREATE', no=34, color='<green>')
|
||||||
|
logger.level('DELETE', no=35, color='<red>')
|
||||||
|
|
||||||
|
|
||||||
def setup_logger():
|
def setup_logger():
|
||||||
logger.remove()
|
logger.remove()
|
||||||
|
4
main.py
4
main.py
@ -16,9 +16,9 @@ def log_event(event):
|
|||||||
actor = event.get('actor')
|
actor = event.get('actor')
|
||||||
|
|
||||||
if event_type == 'DeleteEvent':
|
if event_type == 'DeleteEvent':
|
||||||
logger.error(f'{event_type}:\thttps://github.com/{repo["name"]}, {actor["login"]}')
|
logger.log('DELETE', f'{event_type}:\thttps://github.com/{repo["name"]}, {actor["login"]}')
|
||||||
else:
|
else:
|
||||||
logger.info(f'{event_type}:\thttps://github.com/{repo["name"]}, {actor["login"]}')
|
logger.log('CREATE', f'{event_type}:\thttps://github.com/{repo["name"]}, {actor["login"]}')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
Reference in New Issue
Block a user