Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: VodafoneUSBModem mbed-rtos mbed tinydtls
tinydtls/debug.h@0:6ae42a2aff75, 2013-10-09 (annotated)
- Committer:
- ashleymills
- Date:
- Wed Oct 09 14:48:52 2013 +0000
- Revision:
- 0:6ae42a2aff75
Test program for mbed port of tinydtls
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ashleymills | 0:6ae42a2aff75 | 1 | /* debug.h -- debug utilities |
| ashleymills | 0:6ae42a2aff75 | 2 | * |
| ashleymills | 0:6ae42a2aff75 | 3 | * Copyright (C) 2011--2012 Olaf Bergmann <bergmann@tzi.org> |
| ashleymills | 0:6ae42a2aff75 | 4 | * |
| ashleymills | 0:6ae42a2aff75 | 5 | * Permission is hereby granted, free of charge, to any person |
| ashleymills | 0:6ae42a2aff75 | 6 | * obtaining a copy of this software and associated documentation |
| ashleymills | 0:6ae42a2aff75 | 7 | * files (the "Software"), to deal in the Software without |
| ashleymills | 0:6ae42a2aff75 | 8 | * restriction, including without limitation the rights to use, copy, |
| ashleymills | 0:6ae42a2aff75 | 9 | * modify, merge, publish, distribute, sublicense, and/or sell copies |
| ashleymills | 0:6ae42a2aff75 | 10 | * of the Software, and to permit persons to whom the Software is |
| ashleymills | 0:6ae42a2aff75 | 11 | * furnished to do so, subject to the following conditions: |
| ashleymills | 0:6ae42a2aff75 | 12 | * |
| ashleymills | 0:6ae42a2aff75 | 13 | * The above copyright notice and this permission notice shall be |
| ashleymills | 0:6ae42a2aff75 | 14 | * included in all copies or substantial portions of the Software. |
| ashleymills | 0:6ae42a2aff75 | 15 | * |
| ashleymills | 0:6ae42a2aff75 | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| ashleymills | 0:6ae42a2aff75 | 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| ashleymills | 0:6ae42a2aff75 | 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| ashleymills | 0:6ae42a2aff75 | 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| ashleymills | 0:6ae42a2aff75 | 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| ashleymills | 0:6ae42a2aff75 | 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| ashleymills | 0:6ae42a2aff75 | 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| ashleymills | 0:6ae42a2aff75 | 23 | * SOFTWARE. |
| ashleymills | 0:6ae42a2aff75 | 24 | */ |
| ashleymills | 0:6ae42a2aff75 | 25 | |
| ashleymills | 0:6ae42a2aff75 | 26 | #ifndef _DEBUG_H_ |
| ashleymills | 0:6ae42a2aff75 | 27 | #define _DEBUG_H_ |
| ashleymills | 0:6ae42a2aff75 | 28 | |
| ashleymills | 0:6ae42a2aff75 | 29 | #include "config.h" |
| ashleymills | 0:6ae42a2aff75 | 30 | |
| ashleymills | 0:6ae42a2aff75 | 31 | /** Pre-defined log levels akin to what is used in \b syslog. */ |
| ashleymills | 0:6ae42a2aff75 | 32 | typedef enum { LOG_EMERG=0, LOG_ALERT, LOG_CRIT, LOG_WARN, |
| ashleymills | 0:6ae42a2aff75 | 33 | LOG_NOTICE, LOG_INFO, LOG_DEBUG |
| ashleymills | 0:6ae42a2aff75 | 34 | } log_t; |
| ashleymills | 0:6ae42a2aff75 | 35 | |
| ashleymills | 0:6ae42a2aff75 | 36 | /** Returns the current log level. */ |
| ashleymills | 0:6ae42a2aff75 | 37 | log_t dtls_get_log_level(); |
| ashleymills | 0:6ae42a2aff75 | 38 | |
| ashleymills | 0:6ae42a2aff75 | 39 | /** Sets the log level to the specified value. */ |
| ashleymills | 0:6ae42a2aff75 | 40 | void dtls_set_log_level(log_t level); |
| ashleymills | 0:6ae42a2aff75 | 41 | |
| ashleymills | 0:6ae42a2aff75 | 42 | /** |
| ashleymills | 0:6ae42a2aff75 | 43 | * Writes the given text to \c stdout. The text is output only when \p |
| ashleymills | 0:6ae42a2aff75 | 44 | * level is below or equal to the log level that set by |
| ashleymills | 0:6ae42a2aff75 | 45 | * set_log_level(). */ |
| ashleymills | 0:6ae42a2aff75 | 46 | void dsrv_log(log_t level, char *format, ...); |
| ashleymills | 0:6ae42a2aff75 | 47 | |
| ashleymills | 0:6ae42a2aff75 | 48 | /* A set of convenience macros for common log levels. */ |
| ashleymills | 0:6ae42a2aff75 | 49 | #define info(...) dsrv_log(LOG_INFO, __VA_ARGS__) |
| ashleymills | 0:6ae42a2aff75 | 50 | #define warn(...) dsrv_log(LOG_WARN, __VA_ARGS__) |
| ashleymills | 0:6ae42a2aff75 | 51 | #define debug(...) dsrv_log(LOG_DEBUG, __VA_ARGS__) |
| ashleymills | 0:6ae42a2aff75 | 52 | |
| ashleymills | 0:6ae42a2aff75 | 53 | #endif /* _DEBUG_H_ */ |