A
A
Artem2014-10-14 10:48:31
linux
Artem, 2014-10-14 10:48:31

Who knows ready-made solutions for collecting traces?

Kotany, tell me ready-made bikes for collecting traces.
I want to:
- Output traces to the console
- Write all or selective traces to a file
- Connect remotely by the client for convenient analysis in the GUI
Cherry on the cake:
- Remote control of tracing settings from under the GUI client
Language: C || C++
It is desirable(!) that these messages are not "started" through macros. better some static object or functions.
If not, then you'll have to write your own...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fedor Laktionov, 2015-06-10
@megat72

It is desirable(!) that these messages are not "started" through macros. better some static object or functions.

I think it's just a matter of C/C++. These are unmanaged languages, so you still have to work with pens.
Write a banal function to write a trace to a file:
void WriteMyTrace( char*pszTrace, ... ){
  va_list ap;
  FILE*f;
  va_start( ap, pszTrace );
  f = fopen( TRACE_FILE_NAME, "a" );
  vfprintf( f, pszTrace, ap );
  fclose( f );
  va_end( ap );
}

Write a macro that will call it:
And you place traps in your code:
...
if( !something( x, y, z ) ){
  TRACE( "something [%i, %x, %s]", x, y, z );
  return false;
}
if( !something_two( a, b ) ){
  TRACE( "something two [%i]", b - a );
  return false;
}
...

Tracer is ready. It wasn't difficult.
In my opinion, the question would be more interesting not about collecting traces, but about tools for their analysis , because. collecting them for a C/C++ programmer is not a problem, the format of their presentation is also not worth it, but correctly understanding and finding errors on them, especially in multi-threaded programs, is a completely different matter.

I
Igor, 2016-11-12
@verdex

Because you first use the mysqli extension for connection and query, and then mysql. Don't use mysql. It has been outdated for a long time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question