Browse Source

Actually write journal to file.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
9640ca934f
3 changed files with 24 additions and 5 deletions
  1. +17
    -5
      Loggable.C
  2. +4
    -0
      Loggable.H
  3. +3
    -0
      main.C

+ 17
- 5
Loggable.C View File

@@ -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" );
}

+ 4
- 0
Loggable.H View File

@@ -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
- 0
main.C View File

@@ -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…
Cancel
Save