hugvey/hugvey_server.py

39 lines
1.1 KiB
Python

import argparse
import logging
import coloredlogs
from hugvey.central_command import CentralCommand
if __name__ == '__main__':
argParser = argparse.ArgumentParser(
description='Start up a Hugvey Central Command. Ready to receive voices and other events, and eager to send commands')
argParser.add_argument(
'--config',
'-c',
required=True,
type=str,
help='The yaml config file to load'
)
argParser.add_argument(
'--verbose',
'-v',
action='count', default=0
)
args = argParser.parse_args()
# print(coloredlogs.DEFAULT_LOG_FORMAT)
# exit()
loglevel = logging.NOTSET if args.verbose > 1 else logging.DEBUG if args.verbose > 0 else logging.INFO
coloredlogs.install(
level=loglevel,
# default: "%(asctime)s %(hostname)s %(name)s[%(process)d] %(levelname)s %(message)s"
fmt="%(asctime)s %(hostname)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s"
)
command = CentralCommand(debug_mode=args.verbose > 0)
command.loadConfig(args.config)
command.start()