Skip to content

Commit

Permalink
feat: Add logging to all examples
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol committed Sep 12, 2023
1 parent 897381f commit 1f23cbd
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 1 deletion.
6 changes: 6 additions & 0 deletions examples/ordering-by-exit-server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import json
import logging
import signal

from callosum.lower.zeromq import ZeroMQAddress, ZeroMQRPCTransport
Expand Down Expand Up @@ -61,4 +62,9 @@ async def serve():


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
asyncio.run(serve())
6 changes: 6 additions & 0 deletions examples/ordering-by-key-server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import json
import logging
import signal

from callosum.lower.zeromq import ZeroMQAddress, ZeroMQRPCTransport
Expand Down Expand Up @@ -61,4 +62,9 @@ async def serve() -> None:


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
asyncio.run(serve())
6 changes: 6 additions & 0 deletions examples/ordering-client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import json
import logging

from callosum.lower.zeromq import ZeroMQAddress, ZeroMQRPCTransport
from callosum.rpc import Peer
Expand Down Expand Up @@ -38,4 +39,9 @@ async def call() -> None:


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
asyncio.run(call())
6 changes: 6 additions & 0 deletions examples/simple-client-redis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import json
import logging
import os
import random
import secrets
Expand Down Expand Up @@ -51,4 +52,9 @@ async def call():


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
asyncio.run(call())
6 changes: 6 additions & 0 deletions examples/simple-client-thrift.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import logging
import pathlib
import random
import secrets
Expand Down Expand Up @@ -69,4 +70,9 @@ async def call() -> None:


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
asyncio.run(call())
2 changes: 1 addition & 1 deletion examples/simple-client.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ async def multi_clients() -> None:
if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.DEBUG,
level=logging.INFO,
)
log = logging.getLogger()

Expand Down
6 changes: 6 additions & 0 deletions examples/simple-consumer-redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""
import asyncio
import json
import logging
import os
import signal

Expand Down Expand Up @@ -63,4 +64,9 @@ async def consume() -> None:


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
asyncio.run(consume())
6 changes: 6 additions & 0 deletions examples/simple-publisher-redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
import asyncio
import json
import logging
import os
import random
import secrets
Expand Down Expand Up @@ -52,4 +53,9 @@ async def addition_event(addend1: int, addend2: int):


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
asyncio.run(publish())
6 changes: 6 additions & 0 deletions examples/simple-server-redis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import json
import logging
import os
import signal
import time
Expand Down Expand Up @@ -54,4 +55,9 @@ async def serve() -> None:


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
asyncio.run(serve())
6 changes: 6 additions & 0 deletions examples/simple-server-thrift.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import logging
import pathlib
import signal

Expand Down Expand Up @@ -55,4 +56,9 @@ async def serve() -> None:


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
asyncio.run(serve())
6 changes: 6 additions & 0 deletions examples/simple-server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import json
import logging
import signal
import sys
import tracemalloc
Expand Down Expand Up @@ -153,4 +154,9 @@ def main(scheduler_type):


if __name__ == "__main__":
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
level=logging.INFO,
)
log = logging.getLogger()
main()

0 comments on commit 1f23cbd

Please sign in to comment.