Automated update of package.
This commit is contained in:
parent
178c72404d
commit
c93d588ff1
@ -10,3 +10,22 @@ Description-Content-Type: text/markdown
|
|||||||
Requires-Dist: requests==2.32.3
|
Requires-Dist: requests==2.32.3
|
||||||
Requires-Dist: aiohttp
|
Requires-Dist: aiohttp
|
||||||
Requires-Dist: app@ git+https://retoor.molodetz.nl/retoor/app.git
|
Requires-Dist: app@ git+https://retoor.molodetz.nl/retoor/app.git
|
||||||
|
|
||||||
|
# Mololog
|
||||||
|
|
||||||
|
Mololog is a logging framework for python applications.
|
||||||
|
|
||||||
|
It contains three applications:
|
||||||
|
- mololog.serve
|
||||||
|
- mololog.test
|
||||||
|
- mololog.bench
|
||||||
|
|
||||||
|
## Running mololog server
|
||||||
|
```
|
||||||
|
mololog.serve --host=127.0.0.1 --port=3016 --db=mololog.db
|
||||||
|
```
|
||||||
|
## Implementation of logger in application
|
||||||
|
```
|
||||||
|
from mololog.client import patch
|
||||||
|
patch("https://your-logging-server.nl")
|
||||||
|
```
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
README.md
|
||||||
pyproject.toml
|
pyproject.toml
|
||||||
setup.cfg
|
setup.cfg
|
||||||
src/mololog/__init__.py
|
src/mololog/__init__.py
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
import asyncio
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from app.app import Application as BaseApplication
|
from app.app import Application as BaseApplication
|
||||||
|
|
||||||
@ -12,7 +13,6 @@ class Application(BaseApplication):
|
|||||||
self.test = test
|
self.test = test
|
||||||
self.total_received = 0
|
self.total_received = 0
|
||||||
|
|
||||||
|
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.middlewares.append(self.test_middleware)
|
self.middlewares.append(self.test_middleware)
|
||||||
@ -27,13 +27,11 @@ class Application(BaseApplication):
|
|||||||
async def test_middleware(self, request, handler):
|
async def test_middleware(self, request, handler):
|
||||||
result = await handler(request)
|
result = await handler(request)
|
||||||
|
|
||||||
|
|
||||||
if self.total_received == self.test:
|
if self.total_received == self.test:
|
||||||
await asyncio.create_task(self.exit_app())
|
await asyncio.create_task(self.exit_app())
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
async def handle_emit(self, request):
|
async def handle_emit(self, request):
|
||||||
data = await request.json()
|
data = await request.json()
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
|
16
test.py
16
test.py
@ -1,21 +1,25 @@
|
|||||||
import subprocess
|
|
||||||
import shlex
|
import shlex
|
||||||
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
processes = [
|
processes = [
|
||||||
subprocess.Popen(shlex.split("./.venv/bin/mololog.serve --host=127.0.0.1 --port=3999 --db=':memory:' --test=3")),
|
subprocess.Popen(
|
||||||
subprocess.Popen(shlex.split("./.venv/bin/mololog.test --url=http://localhost:3999"))
|
shlex.split(
|
||||||
|
"./.venv/bin/mololog.serve --host=127.0.0.1 --port=3999 --db=':memory:' --test=3"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
subprocess.Popen(
|
||||||
|
shlex.split("./.venv/bin/mololog.test --url=http://localhost:3999")
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
for process in processes:
|
for process in processes:
|
||||||
while True:
|
while True:
|
||||||
process.poll()
|
process.poll()
|
||||||
if not process.returncode is None:
|
if process.returncode is not None:
|
||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
exit(process.returncode)
|
exit(process.returncode)
|
||||||
break
|
break
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
print("Test sucess!")
|
print("Test sucess!")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user