-
Notifications
You must be signed in to change notification settings - Fork 32
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
ulsp: add a logger class #477
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are probably as many ways to write a logger class as there are authors of such classes. Many choices are a matter of style (and here is not really the place to debate them). We can probably take the experience we get from using this class and feed it into the creatiion of a library logging class. The two changes I would ask for is that the more important/critical messages are immediately flushed, to avoid any danger of them being lost. The second change is to make the class thread safe so logging messages that are the result of a single use of the class come out together rather than being interspersed with other concurrent logging usage: there are already comments in the ulsp source about using threads, so we might as well get this right to start with.
bd82141
to
7aa1b37
Compare
@Don-Ward I agree. Those are good suggestions, but I'm trying to get something going in the short term. I updated the PR to allow defining debug classes/filters. I added a c command line option just as an example, with a couple of debug message use case for demonstration purposes. A log message will be printed if the log level is high enough for it to be printed, or it matches a calls/filter. Filter supports sub-classes too. Ex:
|
Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
I made further updates, changing the filtering logic based on testing I did. I also changed "filter" to "class". Log level now much be 8+ for filters to work, I.e, debugging must be enabled. I added
|
example log file
|
ulsp: add a logger class
This adds a general logging class that I hope to move to the library. For now keeping it and using it in ulsp.
example run