COSA
An Object-Oriented Platform for Arduino Programming
|
Go to the source code of this file.
Classes | |
class | Trace |
Macros | |
#define | LOG_EMERG 0 /* System is unusable */ |
#define | LOG_ALERT 1 /* Action must be taken immediately */ |
#define | LOG_CRIT 2 /* Critical conditions */ |
#define | LOG_ERR 3 /* Error conditions */ |
#define | LOG_WARNING 4 /* Warning conditions */ |
#define | LOG_NOTICE 5 /* Normal but significant condition */ |
#define | LOG_INFO 6 /* Informational */ |
#define | LOG_DEBUG 7 /* Debug-level messages */ |
#define | LOG_MASK(prio) (1 << (prio)) |
#define | LOG_UPTO(prio) (LOG_MASK((prio) + 1) - 1) |
#define | FATAL(msg) |
#define | ASSERT(expr) |
#define | TRACE_P(str) trace.print(PSTR(str)) |
#define | TRACE(expr) |
#define | TRACE_LOG(msg, ...) |
#define | IS_LOG_PRIO(prio) (trace_log_mask & LOG_MASK(prio)) |
#define | EMERG(msg, ...) if (IS_LOG_PRIO(LOG_EMERG)) TRACE_LOG("emerg:" msg, __VA_ARGS__) |
#define | ALERT(msg, ...) if (IS_LOG_PRIO(LOG_ALERT)) TRACE_LOG("alert:" msg, __VA_ARGS__) |
#define | CRIT(msg, ...) if (IS_LOG_PRIO(LOG_CRIT)) TRACE_LOG("crit:" msg, __VA_ARGS__) |
#define | ERR(msg, ...) if (IS_LOG_PRIO(LOG_ERR)) TRACE_LOG("err:" msg, __VA_ARGS__) |
#define | WARNING(msg, ...) if (IS_LOG_PRIO(LOG_WARNING)) TRACE_LOG("warning:" msg, __VA_ARGS__) |
#define | NOTICE(msg, ...) if (IS_LOG_PRIO(LOG_NOTICE)) TRACE_LOG("notice:" msg, __VA_ARGS__) |
#define | INFO(msg, ...) if (IS_LOG_PRIO(LOG_INFO)) TRACE_LOG("info:" msg, __VA_ARGS__) |
#define | DEBUG(msg, ...) if (IS_LOG_PRIO(LOG_DEBUG)) TRACE_LOG("debug:" msg, __VA_ARGS__) |
#define | MEASURE(msg, cnt) |
#define | measure(msg, cnt) |
Variables | |
uint8_t | trace_log_mask |
Trace | trace |
Copyright (C) 2012-2015, Mikael Patel
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library 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 Lesser General Public License for more details.
This file is part of the Arduino Che Cosa project.
Definition in file Trace.hh.
#define ALERT | ( | msg, | |
... | |||
) | if (IS_LOG_PRIO(LOG_ALERT)) TRACE_LOG("alert:" msg, __VA_ARGS__) |
#define ASSERT | ( | expr | ) |
Support macro to check that an expression is valid. The expression is used as a string and evaluated. If false a message is printed to the trace device and the program will terminate.
[in] | expr | expression to validate. |
#define CRIT | ( | msg, | |
... | |||
) | if (IS_LOG_PRIO(LOG_CRIT)) TRACE_LOG("crit:" msg, __VA_ARGS__) |
#define DEBUG | ( | msg, | |
... | |||
) | if (IS_LOG_PRIO(LOG_DEBUG)) TRACE_LOG("debug:" msg, __VA_ARGS__) |
#define EMERG | ( | msg, | |
... | |||
) | if (IS_LOG_PRIO(LOG_EMERG)) TRACE_LOG("emerg:" msg, __VA_ARGS__) |
#define ERR | ( | msg, | |
... | |||
) | if (IS_LOG_PRIO(LOG_ERR)) TRACE_LOG("err:" msg, __VA_ARGS__) |
#define FATAL | ( | msg | ) |
Prints given message with current file name and line number to trace device and the program will terminate. The message string is stored in program memory.
[in] | msg | message string to print. |
#define INFO | ( | msg, | |
... | |||
) | if (IS_LOG_PRIO(LOG_INFO)) TRACE_LOG("info:" msg, __VA_ARGS__) |
#define IS_LOG_PRIO | ( | prio | ) | (trace_log_mask & LOG_MASK(prio)) |
#define LOG_EMERG 0 /* System is unusable */ |
#define LOG_MASK | ( | prio | ) | (1 << (prio)) |
Macros to generate mask for the trace log priorities (LOG_EMERG.. LOG_DEBUG) setting of trace_log_mask. LOG_MASK(prio) bit mask corresponding to the given priority. LOG_UPTO(prio) bit mask for all priorities including the given.
#define MEASURE | ( | msg, | |
cnt | |||
) |
Syntactic sugar for measuring execution time for a block. Used in the form:
[in] | msg | measurement prefix string. |
[in] | cnt | number of block calls (max UINT16_MAX). |
#define measure | ( | msg, | |
cnt | |||
) |
#define NOTICE | ( | msg, | |
... | |||
) | if (IS_LOG_PRIO(LOG_NOTICE)) TRACE_LOG("notice:" msg, __VA_ARGS__) |
#define TRACE | ( | expr | ) |
#define TRACE_LOG | ( | msg, | |
... | |||
) |
Support macro for trace of a log message with line number and function name prefix.
[in] | msg | log message. |
#define TRACE_P | ( | str | ) | trace.print(PSTR(str)) |
#define WARNING | ( | msg, | |
... | |||
) | if (IS_LOG_PRIO(LOG_WARNING)) TRACE_LOG("warning:" msg, __VA_ARGS__) |