1 supporter
Thrift logger

Thrift logger

Dec 01, 2022

Like to use Thrift as a message type format to your project? Probably, logger for it will be useful.









final TProcessor processor = new UglyService.Processor<>(new UglyServiceImpl());

final TServerTransport transport = new TServerSocket(port);

server = new TSimpleServer(new TServer.Args(transport).processor(new LogProcessor(processor, new ServerTestLogger())));

new Thread(() -> server.serve()).start();



public class ServerTestLogger<T> implements Logger<T> {


public void serverResponse(final T field) {"Server Field: {}", field);



public void clientRequest(final T field) {"Client Field: {}", field);




30 [Thread-0] INFO com.github.incu6us.thrift.logger.LoggerProcessorTest$ServerTestLogger - Client Field: {doSomething: 1: 2: some name}

37 [Thread-0] INFO com.github.incu6us.thrift.logger.LoggerProcessorTest$ServerTestLogger - Server Field: {doSomething: {doSomething_result: {success: {Result: {isSuccess: true}{data: Success}{nested: {NestedResult: {netedData: Nested Data}}}}}}}

38 [main] INFO com.github.incu6us.thrift.logger.LoggerProcessorTest - Result: Result(isSuccess:true, data:Success, nested:NestedResult(netedData:Nested Data))

Enjoy this post?

Buy slavka a coffee

More from slavka