mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-04-04 14:07:41 +00:00
Fix BadMsgNotification 17 for PC with not precise system clock
Add logging examples
This commit is contained in:
parent
2c99e21234
commit
3ad36f3e56
2 changed files with 16 additions and 0 deletions
15
EXAMPLES.md
15
EXAMPLES.md
|
|
@ -183,3 +183,18 @@ client.TcpHandler = async (address, port) =>
|
|||
var user = await client.LoginUserIfNeeded();
|
||||
Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name}");
|
||||
```
|
||||
|
||||
# Change logging settings
|
||||
Log to VS Output debugging pane in addition to default Console screen logging:
|
||||
```csharp
|
||||
WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str);
|
||||
```
|
||||
Log to file in replacement of default Console screen logging:
|
||||
```csharp
|
||||
WTelegram.Helpers.Log = (lvl, str) => File.AppendAllText("WTelegram.log", str + Environment.NewLine);
|
||||
```
|
||||
More efficient example with a static variable and detailed logging to file:
|
||||
```csharp
|
||||
static StreamWriter WTelegramLogs = new StreamWriter("WTelegram.log", true, Encoding.UTF8) { AutoFlush = true };
|
||||
...
|
||||
WTelegram.Helpers.Log = (lvl, str) => WTelegramLogs.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [{"TDIWE!"[lvl]}] {str}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue