Initalized git repo, added basic files and a logger
This commit is contained in:
parent
50835e924c
commit
aa155b2748
10 changed files with 479 additions and 0 deletions
1
resa_padel/__init__.py
Normal file
1
resa_padel/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
|
13
resa_padel/__main__.py
Normal file
13
resa_padel/__main__.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
import logging
|
||||
|
||||
import config
|
||||
|
||||
config.init_log_config()
|
||||
|
||||
import booking
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
logger.info("Starting resa_padel")
|
||||
booking.main()
|
||||
logger.info("Finished resa_padel")
|
9
resa_padel/booking.py
Normal file
9
resa_padel/booking.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
import logging
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def main():
|
||||
LOGGER.info("Starting booking padel court")
|
||||
|
||||
LOGGER.info("Finished booking padel court")
|
13
resa_padel/config.py
Normal file
13
resa_padel/config.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
import logging.config
|
||||
import os
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
def init_log_config():
|
||||
root_dir = os.path.realpath(os.path.dirname(__file__))
|
||||
logging_file = root_dir + "/logging.yaml"
|
||||
|
||||
with open(logging_file, "r") as f:
|
||||
logging_config = yaml.safe_load(f.read())
|
||||
logging.config.dictConfig(logging_config)
|
18
resa_padel/logging.yaml
Normal file
18
resa_padel/logging.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
version: 1
|
||||
formatters:
|
||||
simple:
|
||||
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
||||
handlers:
|
||||
console:
|
||||
class: logging.StreamHandler
|
||||
level: DEBUG
|
||||
formatter: simple
|
||||
stream: ext://sys.stdout
|
||||
loggers:
|
||||
sampleLogger:
|
||||
level: DEBUG
|
||||
handlers: [ console ]
|
||||
propagate: no
|
||||
root:
|
||||
level: DEBUG
|
||||
handlers: [ console ]
|
Loading…
Add table
Add a link
Reference in a new issue