diff --git a/README.md b/README.md index 6e0c274..74933f2 100644 --- a/README.md +++ b/README.md @@ -4,36 +4,7 @@ Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) ## TDLib installation -### Ubuntu 18.04 / Debian 9 - -#### Precompiled (v1.3.0) - -Debian: -```bash -su -apt update -apt install -y apt-transport-https curl gnupg -curl "https://repo.zelenin.pw/gpg.key" | apt-key add - -echo "deb [arch=amd64] https://repo.zelenin.pw common contrib" | tee "/etc/apt/sources.list.d/tdlib.list" -apt update -apt install -y tdlib-dev -``` - -Ubuntu: -```bash -sudo apt update -sudo apt install -y apt-transport-https curl gnupg -curl "https://repo.zelenin.pw/gpg.key" | sudo apt-key add - -echo "deb [arch=amd64] https://repo.zelenin.pw common contrib" | sudo tee "/etc/apt/sources.list.d/tdlib.list" -sudo apt update -sudo apt install -y tdlib-dev -``` - -Fedora: -```bash -sudo dnf update -sudo dnf install tdlib-static -``` +### Ubuntu 18-19 / Debian 9 #### Manual compilation @@ -73,10 +44,15 @@ import ( "github.com/zelenin/go-tdlib/client" ) +func WithLogs() client.Option { + return func(tdlibClient *client.Client) { + tdlibClient.SetLogVerbosityLevel(&client.SetLogVerbosityLevelRequest{ + NewVerbosityLevel: 1, + }) + } +} func main() { - client.SetLogVerbosityLevel(1) - // client authorizer authorizer := client.ClientAuthorizer() go client.CliInteractor(authorizer) @@ -108,7 +84,7 @@ func main() { IgnoreFileNames: false, } - tdlibClient, err := client.NewClient(authorizer) + tdlibClient, err := client.NewClient(authorizer, WithLogs()) if err != nil { log.Fatalf("NewClient error: %s", err) } diff --git a/client/tdlib.go b/client/tdlib.go index 14b3aef..9cc8e28 100644 --- a/client/tdlib.go +++ b/client/tdlib.go @@ -97,6 +97,7 @@ func (jsonClient *JsonClient) Destroy() { // Sets the path to the file where the internal TDLib log will be written. // By default TDLib writes logs to stderr or an OS specific log. // Use this method to write the log to a file instead. +// Deprecated func SetLogFilePath(filePath string) { query := C.CString(filePath) defer C.free(unsafe.Pointer(query)) @@ -106,12 +107,14 @@ func SetLogFilePath(filePath string) { // Sets maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated. // Unused if log is not written to a file. Defaults to 10 MB. +// Deprecated func SetLogMaxFileSize(maxFileSize int64) { C.td_set_log_max_file_size(C.longlong(maxFileSize)) } // Sets the verbosity level of the internal logging of TDLib. // By default the TDLib uses a log verbosity level of 5 +// Deprecated func SetLogVerbosityLevel(newVerbosityLevel int) { C.td_set_log_verbosity_level(C.int(newVerbosityLevel)) }