Skip to content

A convenience function which allows for easier error logging and debugging.

License

Notifications You must be signed in to change notification settings

Valkryst/C_Logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A convenience function which allows for easier error logging and debugging.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project