Actually write journal to file.
This commit is contained in:
parent
d3c62adde2
commit
9640ca934f
22
Loggable.C
22
Loggable.C
|
@ -24,23 +24,35 @@
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
FILE *Loggable::_fp;
|
||||
|
||||
int Loggable::_log_id = 0;
|
||||
|
||||
bool
|
||||
Loggable::open ( const char *filename )
|
||||
{
|
||||
if ( ! ( Loggable::_fp = fopen( filename, "a+" ) ) )
|
||||
{
|
||||
printf( "Could not open log file for writing!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Loggable::log ( const char *module, const char *action, const char *fmt, ... )
|
||||
{
|
||||
va_list args;
|
||||
|
||||
/* FIXME: log all this stuff to someplace meaningful */
|
||||
|
||||
printf( "%s %s %p ", module, action, _id );
|
||||
fprintf( _fp, "%-15s %-8s %p ", module, action, _id );
|
||||
|
||||
if ( fmt )
|
||||
{
|
||||
va_start( args, fmt );
|
||||
vfprintf( stdout, fmt, args );
|
||||
vfprintf( _fp, fmt, args );
|
||||
va_end( args );
|
||||
}
|
||||
|
||||
printf( "\n" );
|
||||
fprintf( _fp, "\n" );
|
||||
}
|
||||
|
|
|
@ -21,10 +21,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
class Loggable
|
||||
{
|
||||
|
||||
static FILE *_fp;
|
||||
static int _log_id;
|
||||
|
||||
private:
|
||||
|
@ -32,6 +34,8 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
static bool open ( const char *filename );
|
||||
|
||||
Loggable ( )
|
||||
{
|
||||
_id = ++_log_id;
|
||||
|
|
3
main.C
3
main.C
|
@ -45,6 +45,7 @@
|
|||
#include "Tempo_Track.H"
|
||||
#include "Time_Track.H"
|
||||
|
||||
#include "Loggable.H"
|
||||
|
||||
#include "const.h"
|
||||
|
||||
|
@ -109,6 +110,8 @@ main ( int argc, char **argv )
|
|||
Fl::get_system_colors();
|
||||
Fl::scheme( "plastic" );
|
||||
|
||||
Loggable::open( "history" );
|
||||
|
||||
timeline = new Timeline( 0, 0, 800, 600, "Timeline" );
|
||||
|
||||
// Region *wave = new Region( Clip::from_file( "streambass8.wav" ) );
|
||||
|
|
Loading…
Reference in New Issue