-
Notifications
You must be signed in to change notification settings - Fork 210
Added logging facilities #5
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
Conversation
I'll leave a really big response to every comment: allanference - VA_ARGS is used in place of a format string argument. They'd have to provide a format string argument anyways. This avoids the problem of mandating passing at least one argument with the format string while maintaining portability to non-GCC compilers. Rusty - I've done all your changes. (As a side note, the test in the header file was a remanent of a time when this file was just a header file and some rather ugly macros, when the test actually had some minor semblance of functionality. I forgot to delete it before merging.) |
@allanference I had MSVC and TCC in mind. Even though Microsoft is never going to update, it's nice to provide compatibility. |
What is colors.h? Your _info doesn't compile because it (unnecessarily) includes log.h, and that includes colors.h, which isn't found here (Ubuntu). |
@rustyrussell It's a file I wrote on my machine. It's just a bunch of defines for terminal escape sequences, to make it easier to write colors to the screen. Instead of writing printf("\033[37mHello, world!\n\033[0m"); you can write printf(FG_GRAY "Hello, world!\n" COLOR_END); I had used the file in the initial version of the file. I had realized that I needed to take out the dependency on the file; that's why I defined things like FG_RED. But, I forgot to remove the original include. |
There were still issues, so I put the code in junkcode/ for the moment to expose it to the world, and sent you a pull request which makes it pass ccanlint here. I'd really want a test, too, before pulling it. |
This patch introduces the print_log() facility, which pretty-prints log information to stdout and any logging files specified by the user.