Skip to content

Advanced logging framework for debugging or for logs in release application

License

Notifications You must be signed in to change notification settings

HyperWinX/CClarify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CClarify

Small framework for advanced logging

contributors last commit forks contributors contributors


Contents

About CClarify

CClarify is a small framework for creating advanced logging system. It can write to your custom descriptor, pointing to buffer, and can save everything to file, if you set it to do so.

Installation

  1. Download main header cclarify.h
  2. Include it to your source file, where you want to add logging
  3. Now you should set up everything.
GLOBAL_INIT(); // Init logger variables
Clarifier clar; // Create logger object
// If you have int descriptor like stdout
init_loggerd(clar, descriptor);

// If you want it to write logs to file
init_loggerf(clar, fd);

// If you want it to write logs to both destinations
init_loggerfd(clar, descriptor, fd);
  1. You are good to go now!

Usage

Assign

If you want to assign some value to variable (custom types are not supported) you should do this:

ASSIGN(clar, variable, value);

It will output something like:

==> Assigning value "value" to "variable", old value: "old_var_val"

Exec

If you wanna execute some function, and signal if function started or stopped, do this:

EXEC(clar, function());

It will notify you about started execution:

==> Starting execution of function "function()"

And about end of function execution.

==> Execution of function "function()" finished

Msg

To display some king of message, you need just to use MSG() function.

// To display green info message, do this
MSG(clar, "Hello World!", INFO);
// Yellow - warning
MSG(clar, "Warning", WARNING);
// Red - error
MSG(clar, "Error", ERROR);

Display

Sometimes you want just to display variable value. Do this:

DISPLAY(clar, variable);

and you will get something like:

==> Variable "variable" value: "420"

Wrappers

In last update i've added wrappers for some glibc functions, like malloc. You can enable my variant of them by passing --wrap=func to linker. Currently available functions:

  • malloc()
  • calloc()
  • realloc()
  • free()
  • fopen()
  • fread()
  • fwrite()

About

Advanced logging framework for debugging or for logs in release application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published