Skip to content

fix Exception Log #108

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

Merged
merged 2 commits into from
Mar 31, 2016
Merged

Conversation

MBoretto
Copy link
Collaborator

I introduced the logger Class #106 to Handle the path of the exception logs.
Don't want to rewrite log system now just path this bug #96 .
Exception are not stored by default, you can start log then adding:

Longman\TelegramBot\Logger::initialize('Exceptionlog.log');

in your webhook.php or in your getUpdates.php

@noplanman
Copy link
Member

Great!

About the logging, are we reducing the logs to just 1 file now?
Before we had a file for "Logs" and one for "Exceptions".

With this logger there will be only 1 file that combine both, yes?
Do we want to keep them separate or put all logs together?

The advantage of keeping them separate is that users can simply send us a copy of the exceptions without worrying about sharing private information like bot name or API key, etc.
So it would be great if there were still both. The Logger class manage them all of course.

What do you think?

@MBoretto
Copy link
Collaborator Author

This class handles log for exception while the request one are still menaged by Request class.
Log path are configurable, so if user want can put everything in one file.
I prefer to have separate path for different logs, this also to build the refill feature for the database #106 (comment)

@noplanman
Copy link
Member

So you don't think it would make sense to put all logging functionality together into the Logger class?
My initial idea was to have a class that handles / manages all logging, normal logs and exceptions.
This is to decouple the logging and ease up the configuration.

@MBoretto
Copy link
Collaborator Author

In the future only one class will handles all logs i totally agree!
Maybe we can refactor this in the next release 0.29. Instead in 0.28 we can just be satisfy about this double logging system! What do you think?

@noplanman
Copy link
Member

To me it makes more sense to add a feature when it's thought through more, otherwise it may change again in the next version, which means the user will again need to update their code.
I'd suggest to leave the logging as it is now and maybe just refactor the logging for version 0.29.

It's better to add a "small" feature that works 100% in a separate release, than add bits of it in one and then need to change it again for the next.

@MBoretto
Copy link
Collaborator Author

We could exploit monolog to do this. What do you thing @akalongman @noplanman ?

@noplanman
Copy link
Member

I think that for the logging that we'd be doing a library like that is overkill.
The usage does look nice and simple though ;-)

We're just writing to 2 files, right? One for the Telegram responses and cURL logs, and one for the Exceptions.

An advantage would be that user commands could also include logging very easily, which may be the case!
Also, users could define their own log destinations in the hook.php file, which would be pretty cool.

Hmm, I'm liking the idea of this library more and more as I'm typing this 😄

@MBoretto MBoretto merged commit b14742a into php-telegram-bot:develop Mar 31, 2016
@akalongman
Copy link
Member

I Hightly recommend use monolog.
@noplanman it has many advantages. We dont need test logging behaviour, everything is tested. We dont need implement wotking with filesystem, already exists and etc.

@MBoretto MBoretto deleted the feature/logger branch May 19, 2016 15:20
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

Successfully merging this pull request may close these issues.

3 participants