Prettify output

This commit is contained in:
Eden Kirin
2023-03-23 00:19:16 +01:00
parent e247bdc929
commit 544b7d6c85
3 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,4 @@
import asyncio import asyncio
import logging
import time import time
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
from typing import AsyncGenerator, Optional from typing import AsyncGenerator, Optional
@ -32,6 +31,9 @@ async def get_serve_segments_stub() -> AsyncGenerator[ServeSegmentsStub, None]:
async with grpc.aio.insecure_channel( async with grpc.aio.insecure_channel(
f"{SERVE_SEGMENTS_HOST}:{SERVE_SEGMENTS_PORT}" f"{SERVE_SEGMENTS_HOST}:{SERVE_SEGMENTS_PORT}"
) as channel: ) as channel:
print(
f"🖥 Connected to ServeSegments server on {SERVE_SEGMENTS_HOST}:{SERVE_SEGMENTS_PORT}"
)
yield ServeSegmentsStub(channel) yield ServeSegmentsStub(channel)
@ -91,5 +93,4 @@ async def main():
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig()
asyncio.run(main()) asyncio.run(main())

View File

@ -21,7 +21,6 @@ const PROTO_PACKAGE_OPTIONS = {
function getCurrentTime(call, callback) { function getCurrentTime(call, callback) {
const timezone = call.request.timezone; const timezone = call.request.timezone;
console.log("Received timezone:", timezone);
const now = dayjs().tz(timezone); const now = dayjs().tz(timezone);
callback(null, { callback(null, {
@ -43,7 +42,9 @@ function main() {
}); });
server.bindAsync(`${SERVE_CURRENTTIME_HOST}:${SERVE_CURRENTTIME_PORT}`, ServerCredentials.createInsecure(), () => { server.bindAsync(`${SERVE_CURRENTTIME_HOST}:${SERVE_CURRENTTIME_PORT}`, ServerCredentials.createInsecure(), () => {
console.log(`Starting server on ${SERVE_CURRENTTIME_HOST}:${SERVE_CURRENTTIME_PORT}`); console.log(
`🖧 Starting ServeCurrentTime NodeJS server on ${SERVE_CURRENTTIME_HOST}:${SERVE_CURRENTTIME_PORT}`
);
server.start(); server.start();
}); });
} }

View File

@ -98,7 +98,7 @@ func serve() {
// create ServeSegments server // create ServeSegments server
server := grpc.NewServer() server := grpc.NewServer()
pb_serve_segments.RegisterServeSegmentsServer(server, &grpc_server{}) pb_serve_segments.RegisterServeSegmentsServer(server, &grpc_server{})
log.Printf("server listening at %v", lis.Addr()) log.Printf("🖧 Starting ServeSegments Go server on %v", lis.Addr())
// create connection to ServeCurrentTime server // create connection to ServeCurrentTime server
getCurrentTimeConn, err := grpc.Dial( getCurrentTimeConn, err := grpc.Dial(