8000 Added logging facilities by heshbaugh · Pull Request #5 · rustyrussell/ccan · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Closed
wants to merge 8 commits into from
Closed

Conversation

heshbaugh
Copy link

This patch introduces the print_log() facility, which pretty-prints log information to stdout and any logging files specified by the user.

@heshbaugh
Copy link
Author

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.)

@heshbaugh
Copy link
Author

@allanference I had MSVC and TCC in mind. Even though Microsoft is never going to update, it's nice to provide compatibility.

@rustyrussell
Copy link
Owner

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).

@heshbaugh
Copy link
Author

@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.

@rustyrussell
Copy link
Owner

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.

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
0