mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Fix BadMsgNotification 17 for PC with not precise system clock
Add logging examples
This commit is contained in:
parent
2c99e21234
commit
3ad36f3e56
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}");
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ namespace WTelegram
|
|||
var g_a = BigEndianInteger(serverDHinnerData.g_a);
|
||||
var dh_prime = BigEndianInteger(serverDHinnerData.dh_prime);
|
||||
ValidityChecks(dh_prime, serverDHinnerData.g);
|
||||
session.LastSentMsgId = 0;
|
||||
session.ServerTicksOffset = (serverDHinnerData.server_time - localTime).Ticks;
|
||||
Helpers.Log(1, $"Time offset: {session.ServerTicksOffset} | Server: {serverDHinnerData.server_time.TimeOfDay} UTC | Local: {localTime.TimeOfDay} UTC");
|
||||
//6)
|
||||
|
|
|
|||
Loading…
Reference in a new issue