2018-02-26 19:08:47 +01:00
|
|
|
//
|
2020-01-01 02:23:48 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020
|
2018-02-26 19:08:47 +01:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#include "td/telegram/Log.h"
|
|
|
|
|
|
|
|
#include "td/utils/port/CxCli.h"
|
|
|
|
|
2018-02-28 11:25:07 +01:00
|
|
|
#include <cstdint>
|
|
|
|
|
2018-02-28 02:11:29 +01:00
|
|
|
namespace Telegram {
|
|
|
|
namespace Td {
|
2018-02-28 00:09:23 +01:00
|
|
|
|
2018-02-26 19:08:47 +01:00
|
|
|
using namespace CxCli;
|
2018-02-28 00:09:23 +01:00
|
|
|
|
2018-03-15 17:25:51 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Class for managing internal TDLib logging.
|
|
|
|
/// </summary>
|
2019-02-24 17:17:36 +01:00
|
|
|
[DEPRECATED_ATTRIBUTE("Telegram.Td.Log class is deprecated, please use Telegram.Td.Api.*Log* requests instead.")]
|
2018-02-26 19:08:47 +01:00
|
|
|
public ref class Log sealed {
|
|
|
|
public:
|
2018-03-15 17:25:51 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Changes TDLib log verbosity.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="verbosityLevel">New value of log verbosity level. Must be non-negative.
|
|
|
|
/// 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>
|
2019-02-24 17:17:36 +01:00
|
|
|
[DEPRECATED_ATTRIBUTE("SetVerbosityLevel is deprecated, please use Telegram.Td.Api.SetLogVerbosityLevel request instead.")]
|
2018-03-15 17:25:51 +01:00
|
|
|
static void SetVerbosityLevel(int verbosityLevel) {
|
|
|
|
::td::Log::set_verbosity_level(verbosityLevel);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Sets file path for writing TDLib internal log. By default TDLib writes logs to the System.err.
|
|
|
|
/// Use this method to write the log to a file instead.
|
|
|
|
/// </summary>
|
|
|
|
/// <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>
|
2019-02-24 17:17:36 +01:00
|
|
|
[DEPRECATED_ATTRIBUTE("SetFilePath is deprecated, please use Telegram.Td.Api.SetLogStream request instead.")]
|
2018-03-11 21:49:38 +01:00
|
|
|
static bool SetFilePath(String^ filePath) {
|
|
|
|
return ::td::Log::set_file_path(string_to_unmanaged(filePath));
|
2018-02-26 19:08:47 +01:00
|
|
|
}
|
|
|
|
|
2018-03-15 17:25:51 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Changes maximum size of TDLib log file.
|
|
|
|
/// </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>
|
2019-02-24 17:17:36 +01:00
|
|
|
[DEPRECATED_ATTRIBUTE("SetMaxFileSize is deprecated, please use Telegram.Td.Api.SetLogStream request instead.")]
|
2018-02-26 19:08:47 +01:00
|
|
|
static void SetMaxFileSize(std::int64_t maxFileSize) {
|
|
|
|
::td::Log::set_max_file_size(maxFileSize);
|
|
|
|
}
|
|
|
|
};
|
2018-02-28 00:09:23 +01:00
|
|
|
|
2018-02-28 02:11:29 +01:00
|
|
|
} // namespace Td
|
|
|
|
} // namespace Telegram
|