diff --git a/example/csharp/TdExample.cs b/example/csharp/TdExample.cs index fe0bd026..f6ea3d19 100644 --- a/example/csharp/TdExample.cs +++ b/example/csharp/TdExample.cs @@ -206,8 +206,8 @@ namespace TdExample static void Main() { // disable TDLib log - Td.Log.SetVerbosityLevel(0); - if (!Td.Log.SetFilePath("tdlib.log")) + Td.Client.Execute(new TdApi.SetLogVerbosityLevel(0)); + if (Td.Client.Execute(new TdApi.SetLogStream(new TdApi.LogStreamFile("tdlib.log", 1 << 27))) is TdApi.Error) { throw new System.IO.IOException("Write access to the current directory is required"); } diff --git a/example/uwp/app/MainPage.xaml.cs b/example/uwp/app/MainPage.xaml.cs index 513532d0..b12116cd 100644 --- a/example/uwp/app/MainPage.xaml.cs +++ b/example/uwp/app/MainPage.xaml.cs @@ -27,8 +27,8 @@ namespace TdApp Items = new System.Collections.ObjectModel.ObservableCollection(); _handler = new MyClientResultHandler(this); - Td.Log.SetFilePath(Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "log")); - Td.Log.SetVerbosityLevel(0); + Td.Client.Execute(new TdApi.SetLogVerbosityLevel(0)); + Td.Client.Execute(new TdApi.SetLogStream(new TdApi.LogStreamFile(Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "log"), 1 << 27))); System.Threading.Tasks.Task.Run(() => { @@ -118,7 +118,7 @@ namespace TdApp { var args = command.Split(" ".ToCharArray(), 2); AcceptCommand(command); - _client.Send(new TdApi.DownloadFile(Int32.Parse(args[1]), 1), _handler); + _client.Send(new TdApi.DownloadFile(Int32.Parse(args[1]), 1, 0, 0), _handler); } else if (command.StartsWith("bench")) { diff --git a/td/telegram/LogDotNet.cpp b/td/telegram/LogDotNet.cpp index 65e92aa0..55c4e73d 100644 --- a/td/telegram/LogDotNet.cpp +++ b/td/telegram/LogDotNet.cpp @@ -18,6 +18,7 @@ using namespace CxCli; /// /// Class for managing internal TDLib logging. /// +[DEPRECATED_ATTRIBUTE("Telegram.Td.Log class is deprecated, please use Telegram.Td.Api.*Log* requests instead.")] public ref class Log sealed { public: /// @@ -27,6 +28,7 @@ public: /// Value 0 means FATAL, value 1 means ERROR, value 2 means WARNING, value 3 means INFO, value 4 means DEBUG, /// value greater than 4 can be used to enable even more logging. /// Default value of the log verbosity level is 5. + [DEPRECATED_ATTRIBUTE("SetVerbosityLevel is deprecated, please use Telegram.Td.Api.SetLogVerbosityLevel request instead.")] static void SetVerbosityLevel(int verbosityLevel) { ::td::Log::set_verbosity_level(verbosityLevel); } @@ -38,6 +40,7 @@ public: /// Path to a file for writing TDLib internal log. Use an empty path to switch back to logging /// to the System.err. /// Returns whether opening the log file succeeded. + [DEPRECATED_ATTRIBUTE("SetFilePath is deprecated, please use Telegram.Td.Api.SetLogStream request instead.")] static bool SetFilePath(String^ filePath) { return ::td::Log::set_file_path(string_to_unmanaged(filePath)); } @@ -47,6 +50,7 @@ public: /// /// Maximum size of the file to where the internal TDLib log is written /// before the file will be auto-rotated. Must be positive. Defaults to 10 MB. + [DEPRECATED_ATTRIBUTE("SetMaxFileSize is deprecated, please use Telegram.Td.Api.SetLogStream request instead.")] static void SetMaxFileSize(std::int64_t maxFileSize) { ::td::Log::set_max_file_size(maxFileSize); } diff --git a/tdutils/td/utils/port/CxCli.h b/tdutils/td/utils/port/CxCli.h index 1c601add..6a47116b 100644 --- a/tdutils/td/utils/port/CxCli.h +++ b/tdutils/td/utils/port/CxCli.h @@ -23,6 +23,8 @@ #define REF_NEW ref new #define CLRCALL +#define DEPRECATED_ATTRIBUTE(message) ::Windows::Foundation::Metadata::Deprecated(message,\ + ::Windows::Foundation::Metadata::DeprecationType::Deprecate, 0x0) namespace CxCli { @@ -90,6 +92,7 @@ inline String^ string_from_unmanaged(const std::string &from) { #define REF_NEW gcnew #define CLRCALL __clrcall +#define DEPRECATED_ATTRIBUTE(message) System::ObsoleteAttribute(message) namespace CxCli {