From a0548a12c7d6b9188be47cb688c056dfd512988e Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 27 Jan 2022 13:41:34 +0800 Subject: [PATCH] Make TDLib log output easily --- client/client.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/client/client.go b/client/client.go index 9b3b432..a61843f 100644 --- a/client/client.go +++ b/client/client.go @@ -37,9 +37,23 @@ func WithProxy(req *AddProxyRequest) Option { } } -func WithLogVerbosity(req *SetLogVerbosityLevelRequest) Option { +func SetLogVerbosityLevel(level int32) Option { return func(client *Client) { - client.SetLogVerbosityLevel(req) + client.SetLogVerbosityLevel(&SetLogVerbosityLevelRequest{ + NewVerbosityLevel: level, + }) + } +} + +func SetFilePath(path string) Option { + return func(client *Client) { + client.SetLogStream(&SetLogStreamRequest{ + LogStream: &LogStreamFile{ + Path: path, + MaxFileSize: 10485760, + RedirectStderr: true, + }, + }) } }