-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
log.h: make generating separate log files optional. #3787
Conversation
Co-authored-by: cebtenzzre <cebtenzzre@gmail.com>
Co-authored-by: cebtenzzre <cebtenzzre@gmail.com>
Co-authored-by: cebtenzzre <cebtenzzre@gmail.com>
I can't say much about the code but I 100% approve adding this feature. I hate how currently it's very difficult to predict what the log file will actually be called. (I'll test this when I get a chance.) By the way, it would be nice if |
That sounds like a good idea, it would make it easier to switch between builds with the same exact command line parameters. I'm gonna do that in a separate PR, this one is ready and I don't want to complicate it. |
Hate to say it, but I think this may have broken something. |
@KerfuffleV2 Only compiling with logs disabled, converts LOG_TEE to normal fprintfs, to simulate behavior prior to implementation of logs. The cause of this is here, both print to log and print to screen checks if LOG_TARGET is disabled: Lines 263 to 272 in d606905
A simple fix would be to remove But everything depends on whether this is to be considered a bug or not. EDIT: Would having |
I don't know... You might be right. I hate to say something negative, especially since I've had nothing but positive interactions with you but... I kind of hate the logging system. Every time I stop compiling with it disabled I run into problems.
Ah, not really. I want to see the log messages, I just don't want random files created automatically. Actually, these latest problems are from trying to use it in my I think the problem is that it doesn't really work like other logging systems. With most log systems you have various levels like: Then the app can produce the log messages, they get presented in a relatively nice was as appropriate for where they're going, like with level colors or whatever for the console, etc. Then you basically never have to use But here, I don't really see a way to use the system. |
@KerfuffleV2 You should be able to disable logs at compile time, just for your example, by defining LOG_DISABLE_LOGS before including "common" This will make your example, and only your example, always compile as if LLAMA_DISABLE_LOGS is used, without having to set flags for make or cmake.
|
@staviq I apologize, I really shouldn't have written that post. I guess the filter part of my brain that keeps me from being a jerk had already gone to sleep. You can probably tell I'm a bit frustrated with it, but I wouldn't normally write something like that.
I definitely know that feeling. I don't think it really has to be super complicated or have huge scope. I don't know if it helps, but I can give you an idea of how I think it could look and make a scope: Just something that allows logging with the levels I mentioned. The levels can be an enum so they're ordered, allowing for stuff like In my opinion, anything the program wants to print out that would be a line of text - so with a newline at the end would go through the log facility. There are some exceptions like printing out tokens as they're generated or printing a prompt for user input. The API for using it usually looks something like If you really wanted to be fancy you could also have a way to log, but only to non-console destinations. So like in the case of prompting the user for input, there could also be a I'm not trying to tell you what to do or anything, just sharing my opinions about how it could look just in case it might be helpful to you in some way.
I think I might even have seen that, but from the description it sounded like internal stuff. Unfortunately, I never got around to trying it out.
I might as well just be using |
Many people have "this" and they intuitively understand. I'd tell you not to worry too much about it, but the specifics of "this" are usually such that you will worry anyway :) Your ideas are very helpful, and I will come back to log improvements PR at some point, especially that other parts of the project started using logs, and some sort of use case baseline is now established. My original idea about improving logs already overlaps with your suggestions, and they are very appreciated either way. |
* impl --log-new, --log-append * Update common/log.h Co-authored-by: cebtenzzre <cebtenzzre@gmail.com> * Update common/log.h Co-authored-by: cebtenzzre <cebtenzzre@gmail.com> * Apply suggestions from code review Co-authored-by: cebtenzzre <cebtenzzre@gmail.com> --------- Co-authored-by: cebtenzzre <cebtenzzre@gmail.com>
(cc44877#commitcomment-130881609)
Adds
--log-new
, when specified, reverts to original behavior of creating separatefile.ID.log
log files each run.Adds
--log-append
, when specified, opens log file in append mode.