DHT testprogram

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DebugTrace.h Source File

DebugTrace.h

00001 /*
00002 * DebugTrace. Allows dumping debug messages/values to serial or
00003 * to file.
00004 *
00005 * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk>
00006 *
00007 * This file is part of DebugTrace.
00008 *
00009 * DebugTrace is free software: you can redistribute it and/or modify
00010 * it under the terms of the GNU General Public License as published by
00011 * the Free Software Foundation, either version 3 of the License, or
00012 * (at your option) any later version.
00013 * 
00014 * DebugTrace is distributed in the hope that it will be useful,
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 * GNU General Public License for more details.
00018 *
00019 * You should have received a copy of the GNU General Public License
00020 * along with DebugTrace.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 
00023 #ifndef SNATCH59_DEBUGTRACE_H
00024 #define SNATCH59_DEBUGTRACE_H
00025 
00026 enum eLog {OFF, ON};
00027 enum eLogTarget {TO_SERIAL, TO_FILE};
00028 
00029 class DebugTrace
00030 {
00031 public:
00032    
00033     DebugTrace(eLog on, eLogTarget mode);//, const char* fileName = "debuglog.txt", const int maxSize = 4194304);
00034     ~DebugTrace();
00035   //  char message[80];
00036     void clear();
00037     void traceOut(const char* fmt, ...);
00038     
00039 private:
00040     eLog enabled;
00041     eLogTarget logMode;
00042   /*  int maxFileSize;
00043     int currentFileSize;
00044     char* logFile;
00045     char* logFileBackup;
00046     int logFileStatus;            // if things go wrong, don't write any more data to file*/
00047     
00048     void backupLog();
00049 };
00050 
00051 #endif