![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
DHT testprogram
Fork of DHT_TestProgram by
Debug/DebugTrace.h@0:9ef709bfeb08, 2012-07-10 (annotated)
- Committer:
- Wimpie
- Date:
- Tue Jul 10 13:11:23 2012 +0000
- Revision:
- 0:9ef709bfeb08
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wimpie | 0:9ef709bfeb08 | 1 | /* |
Wimpie | 0:9ef709bfeb08 | 2 | * DebugTrace. Allows dumping debug messages/values to serial or |
Wimpie | 0:9ef709bfeb08 | 3 | * to file. |
Wimpie | 0:9ef709bfeb08 | 4 | * |
Wimpie | 0:9ef709bfeb08 | 5 | * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk> |
Wimpie | 0:9ef709bfeb08 | 6 | * |
Wimpie | 0:9ef709bfeb08 | 7 | * This file is part of DebugTrace. |
Wimpie | 0:9ef709bfeb08 | 8 | * |
Wimpie | 0:9ef709bfeb08 | 9 | * DebugTrace is free software: you can redistribute it and/or modify |
Wimpie | 0:9ef709bfeb08 | 10 | * it under the terms of the GNU General Public License as published by |
Wimpie | 0:9ef709bfeb08 | 11 | * the Free Software Foundation, either version 3 of the License, or |
Wimpie | 0:9ef709bfeb08 | 12 | * (at your option) any later version. |
Wimpie | 0:9ef709bfeb08 | 13 | * |
Wimpie | 0:9ef709bfeb08 | 14 | * DebugTrace is distributed in the hope that it will be useful, |
Wimpie | 0:9ef709bfeb08 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Wimpie | 0:9ef709bfeb08 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Wimpie | 0:9ef709bfeb08 | 17 | * GNU General Public License for more details. |
Wimpie | 0:9ef709bfeb08 | 18 | * |
Wimpie | 0:9ef709bfeb08 | 19 | * You should have received a copy of the GNU General Public License |
Wimpie | 0:9ef709bfeb08 | 20 | * along with DebugTrace. If not, see <http://www.gnu.org/licenses/>. |
Wimpie | 0:9ef709bfeb08 | 21 | */ |
Wimpie | 0:9ef709bfeb08 | 22 | |
Wimpie | 0:9ef709bfeb08 | 23 | #ifndef SNATCH59_DEBUGTRACE_H |
Wimpie | 0:9ef709bfeb08 | 24 | #define SNATCH59_DEBUGTRACE_H |
Wimpie | 0:9ef709bfeb08 | 25 | |
Wimpie | 0:9ef709bfeb08 | 26 | enum eLog {OFF, ON}; |
Wimpie | 0:9ef709bfeb08 | 27 | enum eLogTarget {TO_SERIAL, TO_FILE}; |
Wimpie | 0:9ef709bfeb08 | 28 | |
Wimpie | 0:9ef709bfeb08 | 29 | class DebugTrace |
Wimpie | 0:9ef709bfeb08 | 30 | { |
Wimpie | 0:9ef709bfeb08 | 31 | public: |
Wimpie | 0:9ef709bfeb08 | 32 | |
Wimpie | 0:9ef709bfeb08 | 33 | DebugTrace(eLog on, eLogTarget mode);//, const char* fileName = "debuglog.txt", const int maxSize = 4194304); |
Wimpie | 0:9ef709bfeb08 | 34 | ~DebugTrace(); |
Wimpie | 0:9ef709bfeb08 | 35 | // char message[80]; |
Wimpie | 0:9ef709bfeb08 | 36 | void clear(); |
Wimpie | 0:9ef709bfeb08 | 37 | void traceOut(const char* fmt, ...); |
Wimpie | 0:9ef709bfeb08 | 38 | |
Wimpie | 0:9ef709bfeb08 | 39 | private: |
Wimpie | 0:9ef709bfeb08 | 40 | eLog enabled; |
Wimpie | 0:9ef709bfeb08 | 41 | eLogTarget logMode; |
Wimpie | 0:9ef709bfeb08 | 42 | /* int maxFileSize; |
Wimpie | 0:9ef709bfeb08 | 43 | int currentFileSize; |
Wimpie | 0:9ef709bfeb08 | 44 | char* logFile; |
Wimpie | 0:9ef709bfeb08 | 45 | char* logFileBackup; |
Wimpie | 0:9ef709bfeb08 | 46 | int logFileStatus; // if things go wrong, don't write any more data to file*/ |
Wimpie | 0:9ef709bfeb08 | 47 | |
Wimpie | 0:9ef709bfeb08 | 48 | void backupLog(); |
Wimpie | 0:9ef709bfeb08 | 49 | }; |
Wimpie | 0:9ef709bfeb08 | 50 | |
Wimpie | 0:9ef709bfeb08 | 51 | #endif |