Skip to content
This repository has been archived by the owner on Jun 29, 2019. It is now read-only.
/ CTrace Public archive

Simple logging library with a well formatted output.

License

Notifications You must be signed in to change notification settings

anvouk/CTrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED: improved version available here

CTrace

C/C++ logging library.

The library is divided in these 2 parts:

CTrace

Lightweight cross-platform logging library.

CWinTrace

Pretty much the same as CTrace but adds the following features:

  • Console ouput uses colors.
  • Can retrieve windows error messages.
  • TCHAR support.

Usage

CTrace

void important_function(void)
{
  /* these are not necessary but often useful */
  CTRACE_ENTER_FN();
  
  /* ... does stuff ... */
  
  if (/* condition */) {
    /* An error has occured. Log it and return. */
    CTRACEE("oops! %d - %s", some_number, some_string);
    CTRACE_EXIT_FN();
    return;
  }
  
  /* ... more stuff ... */
  
  /* these are not necessary but often useful */
  CTRACE_EXIT_FN();
}

CWinTrace

void important_function(void)
{
  /* these are not necessary but often useful */
  CWTRACE_ENTER_FN();
  
  /* ... does stuff ... */
  
  if (/* condition */) {
    /* An error has occured. Log it and return. */
    CWTRACEE(TEXT("oops! %d - %s"), some_number, some_wide_string);
    CWTRACE_EXIT_FN();
    return;
  }
  
  /* ... more stuff ... */
  
  /* these are not necessary but often useful */
  CWTRACE_EXIT_FN();
}

More Examples

See the examples folder