Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable verbose logs #24

Closed
mirismaili opened this issue Apr 18, 2020 · 5 comments
Closed

Disable verbose logs #24

mirismaili opened this issue Apr 18, 2020 · 5 comments

Comments

@mirismaili
Copy link
Contributor

mirismaili commented Apr 18, 2020

Thank good library.

How to disable below useful logs to be outputted in the console:

[2020-04-18T18:31:39.876Z] [DEBUG] - [Assigned msgId = 6817121....5403612 to PingRequest]
[2020-04-18T18:31:39.876Z] [DEBUG] - [Encrypting 1 message(s) in 28 bytes for sending]
[2020-04-18T18:31:39.877Z] [DEBUG] - [Encrypted messages put in a queue to be sent]
[2020-04-18T18:31:39.877Z] [DEBUG] - [Waiting for messages to send...]
[2020-04-18T18:31:39.877Z] [DEBUG] - [Assigned msgId = 68171.......4276 to MsgsAck]
[2020-04-18T18:31:39.877Z] [DEBUG] - [Encrypting 1 message(s) in 68 bytes for sending]
[2020-04-18T18:31:39.878Z] [DEBUG] - [Encrypted messages put in a queue to be sent]
[2020-04-18T18:31:39.878Z] [DEBUG] - [Waiting for messages to send...]
[2020-04-18T18:31:40.004Z] [DEBUG] - [Handling pong for message 68171.......5403612]
[2020-04-18T18:31:40.004Z] [DEBUG] - [Receiving items from the network...]
rnd is  30481.....0298941
[2020-04-18T18:32:39.880Z] [DEBUG] - [Assigned msgId = 68171......9442120 to PingRequest]
[2020-04-18T18:32:39.881Z] [DEBUG] - [Encrypting 1 message(s) in 28 bytes for sending]
[2020-04-18T18:32:39.883Z] [DEBUG] - [Encrypted messages put in a queue to be sent]
[2020-04-18T18:32:39.884Z] [DEBUG] - [Waiting for messages to send...]
[2020-04-18T18:32:39.884Z] [DEBUG] - [Assigned msgId = 68171......15441912 to MsgsAck]
[2020-04-18T18:32:39.884Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending]
[2020-04-18T18:32:39.886Z] [DEBUG] - [Encrypted messages put in a queue to be sent]
[2020-04-18T18:32:39.886Z] [DEBUG] - [Waiting for messages to send...]
[2020-04-18T18:32:40.010Z] [DEBUG] - [Handling pong for message 68171.....99442120]
[2020-04-18T18:32:40.010Z] [DEBUG] - [Receiving items from the network...]
rnd is  79195.....8965
[2020-04-18T18:33:39.884Z] [DEBUG] - [Assigned msgId = 68171......479672 to PingRequest]
[2020-04-18T18:33:39.884Z] [DEBUG] - [Encrypting 1 message(s) in 28 bytes for sending]
[2020-04-18T18:33:39.886Z] [DEBUG] - [Encrypted messages put in a queue to be sent]
[2020-04-18T18:33:39.887Z] [DEBUG] - [Waiting for messages to send...]
[2020-04-18T18:33:39.887Z] [DEBUG] - [Assigned msgId = 68171......479756 to MsgsAck]
[2020-04-18T18:33:39.888Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending]
[2020-04-18T18:33:39.889Z] [DEBUG] - [Encrypted messages put in a queue to be sent]
[2020-04-18T18:33:39.890Z] [DEBUG] - [Waiting for messages to send...]
[2020-04-18T18:33:40.013Z] [DEBUG] - [Handling pong for message 6817121642213479672]
[2020-04-18T18:33:40.014Z] [DEBUG] - [Receiving items from the network...]

image

I know these are useful information that help debug purposes, but I don't want to see them between my own logs, in the general states (or see my own logs between them!).

Copy link
Contributor

watzon commented Apr 18, 2020

@mirismaili You can set your own logger using the baseLogger option in the TelegramClient constructor https://github.com/gram-js/gramjs/blob/master/gramjs/client/TelegramClient.js#L34

@mirismaili
Copy link
Contributor Author

mirismaili commented Apr 18, 2020

@watzon Thanks a lot. Referring to:

static levels = ['debug', 'info', 'warn', 'error']
I used:

new TelegramClient(session, API_ID, API_HASH, {baseLogger: new Logger('warn')})  // Logger = require('telegram/gramjs/extensions').Logger

and the majority of the issue was solved. Although rnd is ... is still being logged.

@painor
Copy link
Member

painor commented Apr 18, 2020

the rnd thing is probably some debug console log that I forgot to remove. if you can find it please PR 😄

@watzon
Copy link
Contributor

watzon commented Apr 19, 2020

I can even add it to my PR, I'll do some looking.

Edit: may have already removed it, I can't find it.

@painor
Copy link
Member

painor commented Nov 19, 2020

it should be working fine now with the latest update. Reopen if it's not

@painor painor closed this as completed Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants