Closed MSch closed 13 years ago
Lucky for you, it can't be automatically merged anyway ;)
Also it's currently only a collection of snippets :)
Have we decided on a logging-framework yet?
As I saw @eaigner likes a very lightweight solution using printf, therefore his NKShow - macro. While this definitely has some advantages I still like a full-fledged solution using log levels, different log locations etc. and am pretty happy with CocoaLumberJack in comination with VTPG_Common. I haven't really had time to look into your branch in detail @MSch.
So maybe we should support both ways, full-fledged and lightweight.
My branch is currently only a collection of snippets, but I'm going the @eaigner route. I think if people are happy with CocoaLumberJack they should use CocoaLumberJack.
@myell0w log levels are no problem. The NKShow
macro shouldn't replace a log function in the first place, but it's just the equivalent of a CFShow
or -description
for plain types/structs like CGRect
, CGPoint
.
We definitely will support both - sometimes lightweigt is enough, sth file-based logger+controllable levels at runtime are really handy...
@steipete Don't close (unfinished) pull requests
Ok, now I'd need some serious C help /cc @steipete, @eaigner, @myell0w
&object
, *object
didn't work.
@MSch sorry for closing, pressed the wrong button yesterday w/o thinking.
Hmm - this is already pretty advanced code. How do you get the sentinel? Will i have to terminate the va_args myself?
e.g. NKLog(a,b,c,NULL) .. (or your token)
Can you clarify your plans? And what kNRInternalEndVarArgs will do exactly?
This compiler trick seems pretty good - but does it work for clang? You referenced it in the header, are you using sth like N_ARGS(...)?
http://stackoverflow.com/questions/2632300/looping-through-macro-varargs-values
It is standard C99 and works on GCC, Clang with and without GCC extensions.
My plans are to make it work like https://gist.github.com/1062704
I'm also adding NKLogStr
which returns a NSString*
for integrating in logging frameworks.
Sorry this took so long. Got a working implementation in 6999ea7f4f7e1132e490258fd96a9b60a0162a52 now.
Supports FKLogToString which returns an NSString and FKLog which NSLogs that string.
The idea is for users of FoundationKit to define their own Log macro that's conditional on the DEBUG macro, like this:
#ifdef DEBUG
#define Log(...) FKLog(__VA_ARGS__)
#else
#define Log(...)
#endif
We're currently using this:
#define Log(...) FKLog(__VA_ARGS__)
#ifdef DEBUG
#define DebugLog(...) FKLog(__VA_ARGS__)
#define DebugNSLog(...) NSLog(__VA_ARGS__)
#else
#define DebugLog(...)
#define DebugNSLog(...)
#endif
This will become the ultimative logging method:
https://gist.github.com/1062703 and https://github.com/steipete/PSFoundation/blob/master/Lumberjack/VTPG_Common.h
PLEASE DON'T MERGE THIS, THIS PULL REQUEST IS FOR DISCUSSING THE BRANCH