-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add a logging mechanism #9
Comments
We should probably implement something to make the logging optional. No use to have a bunch of log files, when you don't really need them. |
Of course that's right! |
If we do log stuff, we should probably use a combination of a log manager (with buffer) and these functions: I'm looking into this as we speak, because lets face it; the current log system doesn't really work. It fails to save files half the time. Why use a log manager with buffer? Because rapidly logging items to a file kills I/O performance and generally isn't nice for hard drives anyway. |
It does? I have never had a problem with the current log system. |
The bot randomly saves or doesn't save log files for me. I can't find the logic behind it. |
It opens a file handle and then writes to it there and then, which means no memory buffer or anything unless that has been changed recently? You can even EDIT: You seem to contradict yourself by saying that the bot uses a lot of memory, but doesn't because it thrashes the disk, I'm a little confused. |
It opens a file handle, but forgets to write the file I guess. Either way, I'm making a LogManager to help maintain it and separate all this from the main Bot.php file. |
Quote: The bot doesn't use a lot of memory, contrary. I mean we should flush the log buffer once in a while so it doesn't eat up all the memory. |
Oh, seems PHP does buffering by itself. Well okay then. http://php.net/manual/en/function.stream-set-write-buffer.php |
Logging instantly is a common feature though, take a look at irssi's logs, they write as the lines are said. Perhaps a better logging solution is needed, that could be toggled between thrash and cache 'n' write. |
I'll make both an option; on slow disks a big buffer can be used for a decent speedup, on faster disks where no problems are met the lines are fwrite'd instantly. |
There is already a mechanism for logging.
But I think it's better to define a Logger for this task, that is assigned to a bot OR a connection.
So everything, the bot, commands, are able to log something.
The text was updated successfully, but these errors were encountered: