-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemure-logger-pipe.py
More file actions
37 lines (26 loc) · 895 Bytes
/
demure-logger-pipe.py
File metadata and controls
37 lines (26 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /usr/bin/env python
import os
import sys
import uuid
import asyncio
import pathlib
import importlib.util
from demure_logger.handlers.pipe import Handler, Config
if __name__ == '__main__':
config_path = os.path.join( os.getcwd( ), 'demure.pipe.config.py' )
if len( sys.argv ) > 1:
config_path = sys.argv[1]
if not os.path.exists( config_path ):
config_path = os.path.join(
str( pathlib.Path( sys.path[0] ).parent ),
'config',
'demure.pipe.default.config.py'
)
spec = importlib.util.spec_from_file_location( str( uuid.uuid4( ) ), config_path )
config = importlib.util.module_from_spec( spec )
spec.loader.exec_module( config )
handler = Handler( **Config.from_module( config ) )
loop = asyncio.new_event_loop( )
loop.run_until_complete(
handler.run( )
)