Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.41 KB

README.md

File metadata and controls

30 lines (21 loc) · 1.41 KB

The foci of this repository are the logger.c and logger.h files. They define the printError function which allows you to print detailed and descriptive error messages to aid in development and debugging.

Compiling

Add logger.c and logger.h to your project, update your build script, and compile as you normally would.

See the provided Makefile as a reference.

Usage

See C_Mutex and C_PThread as references.

Parameters:

  1. If you know that an error has occured and that errno has been set, then set the first parameter to errno. Else set it to 0.
  2. This should be set to __FILE__, but it also accepts NULL.
  3. This should be set to __PRETTY_FUNCTION__, but it also accepts NULL.
  4. This should contain a descriptive error message, specific to your program, and should contain information helpful in debugging the related error. This also accepts NULL.

Example:

printError(errno, __FILE__, __PRETTY_FUNCTION__, "Some error message.");