Deprecate Log in .NET native binding.
GitOrigin-RevId: 08d3321d68a7406dd0e2a5f5877619d9e864ba1e
This commit is contained in:
parent
3226e859ad
commit
6af95d721d
@ -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");
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ namespace TdApp
|
||||
Items = new System.Collections.ObjectModel.ObservableCollection<string>();
|
||||
_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"))
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ using namespace CxCli;
|
||||
/// <summary>
|
||||
/// Class for managing internal TDLib logging.
|
||||
/// </summary>
|
||||
[DEPRECATED_ATTRIBUTE("Telegram.Td.Log class is deprecated, please use Telegram.Td.Api.*Log* requests instead.")]
|
||||
public ref class Log sealed {
|
||||
public:
|
||||
/// <summary>
|
||||
@ -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.</param>
|
||||
[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:
|
||||
/// <param name="filePath">Path to a file for writing TDLib internal log. Use an empty path to switch back to logging
|
||||
/// to the System.err.</param>
|
||||
/// <returns>Returns whether opening the log file succeeded.</returns>
|
||||
[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:
|
||||
/// </summary>
|
||||
/// <param name="maxFileSize">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.</param>
|
||||
[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);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user