libgit2/libgit2 — pull request #1403 by ethomson (2013-03-07 18:11:16+00:00)
Title: Optional tracing back to consumers

We would like to have more diagnostic data coming out of libgit2 and going into our application logs. We are particularly concerned with warnings and errors as getting accurate and complete conditions that lead to errors from the existing sources is not always possible. We would like another source of data to aide troubleshooting.

Thus, we would like to add tracing into libgit2, such that:

1. Consumers can send this diagnostic data to whatever they're already using to log events (log file, syslog, stderr, etc)
2. This functionality can be compiled out entirely (and is not even included by default)
3. When setting a callback, consumers provide the greatest level of detail they're interested in. This prevents us from calling back with data they're not interested in.
4. Provide an inexpensive calculation to determine if the logging level is at a certain level. This allows us to skip potentially expensive string creation that would be immediately ignored.

The diagnostic levels are modeled after those used by log4j and log4net for familiarity. However, that's the extent of familiarity with systems that provide significant logging capabilities.

An immediate useful thing may be to have failures routed through this mechanism - for example, extending `giterr_set` to call `git_trace`.