aharren / LibComponentLogging-Core

A small logging library for Objective-C applications (Mac OS X and iPhone OS/iOS) which provides conditional logging based on log levels and log components. Additionally, different logging strategies can be used, e.g. writing log messages to a file or sending them to the system log, while using the same logging interface.
http://0xc0.de/LibComponentLogging
110 stars 11 forks source link

Make it work in plain C apps #25

Closed xslim closed 9 years ago

xslim commented 9 years ago

This is a basic conversion to allow LLC work in plain old C apps. Work done:

aharren commented 9 years ago

Good points. Let me first migrate the tests in branch devel from OCTest to XCTest.

xslim commented 9 years ago

I can redo my work on top of devel branch if needed. Also, maybe it's easier to do tests in plain C and skip invoking Xcode? Same as I did (see Makefile and .travis)

aharren commented 9 years ago

I will have a deeper look at it tomorrow.

aharren commented 9 years ago

I will integrate the changes in the devel branch. The tests are considering different scenarios (OS X, iOS, framework builds, Objective-C++); I will add a C scenario there.

xslim commented 9 years ago

I think ther's no big need in uint32_t as size of int is quite enough for all components that you might imagine in a normal app / library...

aharren commented 9 years ago

Right. It's more about using a type with a well-defined size, instead of a compiler/platform-specific type.

xslim commented 9 years ago

Indeed, I agree, including stdint will work

aharren commented 9 years ago

Please try the latest version from the devel branch. A default _lcl_logger implementation is not there yet.

xslim commented 9 years ago

Seems OK for me, the only thing I would add is:

The last one has at least one interesting use cases:

See WWDC 2014, session 714, "fix_bugs_faster_using_activity_tracing"

aharren commented 9 years ago

Will continue on this in the next days.

What's the use-case for the default level?

aharren commented 9 years ago

1, 2, and 4 are in.

xslim commented 9 years ago

Use case of default level - well, by default, the log is off as it's not configured... Adding a default configuration can help "quickstart"

aharren commented 9 years ago

Hmm, you can set the value for all components via e.g. lcl_configure_by_identifier("*", lcl_vTrace);. Adding an additional default level has the negative effect that we need to check two trace-levels: the component's level and the default level.

aharren commented 9 years ago

@xslim can you try the current code from the devel branch, please? If everything works for your scenario, then we could go for a 1.4.1 release.

xslim commented 9 years ago

Will do tomorrow)

Sent from my iPhone

On Nov 23, 2014, at 13:52, Arne Harren notifications@github.com wrote:

@xslim can you try the current code from the devel branch, please? If everything works for your scenario, then we could go for a 1.4.1 release.

— Reply to this email directly or view it on GitHub.

aharren commented 9 years ago

@xslim did you have a chance to take a look?

xslim commented 9 years ago

Seems fine to me

xslim commented 9 years ago

I think you can make a release. Good catch with __has_include, it's not available on some compilers. We are integrating the logging system in our big C project on embedded platform currently... I hope by Tuesday I can make a note how that worked.

aharren commented 9 years ago

ok, I'll wait; we're not in a hurry :)

aharren commented 9 years ago

@xslim any news on this?

xslim commented 9 years ago

Yep, it works)

Sent from my iPhone

On 10 Jan 2015, at 08:43, Arne Harren notifications@github.com wrote:

@xslim any news on this?

— Reply to this email directly or view it on GitHub.

aharren commented 9 years ago

will try to release the new version on the weekend

aharren commented 9 years ago

https://github.com/aharren/LibComponentLogging-Core/releases/tag/1.4.1