/***************************************************************************
 *   Copyright (C) 2006 by Jens Koehler                                    *
 *   irimi_at_gmx_de                                                       *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include <iostream>
#include "debugTracer.h"

using namespace std;

#ifdef AMAROK_DEBUG
int AMAROK_TRACER_LEVEL_THRESHOLD=AMAROK_TRACE_DEBUG;
#else
int AMAROK_TRACER_LEVEL_THRESHOLD=AMAROK_TRACE_ERROR;
#endif


void DebugTracer::out (AMAROK_TRACE_LEVEL level, const char* text) const
{

    if (level<=AMAROK_TRACER_LEVEL_THRESHOLD)
    {

        switch (level)
        {
        case AMAROK_TRACE_INFO:
        case AMAROK_TRACE_ERROR:
	case AMAROK_TRACE_DEBUG:
            cout << text << endl;

            break;

        case AMAROK_TRACE_NONE: // do nothing

        default:
            break;

        }
    }
}

void DebugTracer::setTraceLevel (AMAROK_TRACE_LEVEL newlevel)
{
    AMAROK_TRACER_LEVEL_THRESHOLD= newlevel;
}

int DebugTracer::getTraceLevel () const
{
    return AMAROK_TRACER_LEVEL_THRESHOLD;
}
void DebugTracer::infoOut (const char* text) const
{
    out (AMAROK_TRACE_INFO,text);
}
void DebugTracer::errorOut (const char* text) const
{
    out (AMAROK_TRACE_ERROR,text);
}

void DebugTracer::debugOut (const char* text) const
{
#ifdef AMAROK_DEBUG
    out (AMAROK_TRACE_DEBUG,text);
#endif
}

