Allow overriding default definitions of logging macros (#384)

* Update logging_stack.h file to avoid use of __FUNCTION__ macro

* Revert to use __FUNCTION__ instead of __FILE__

* Fix comment about metadata format

* Fix incorrect mapping of SdkLog function

* Fix typo causing LOG_METADATA_ARGS to be undefined

* Fix another bug with SdkLog macro definition

* Fix formatting

* Move mapping of SdkLog to vLoggingPrintf from logging_stack to config files

* Remove dependency of LIBRARY_LOG_NAME on LIBRARY_METADATA_* macros

* Minor improvements

Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com>
Co-authored-by: RichardBarry <3073890+RichardBarry@users.noreply.github.com>
This commit is contained in:
Archit Aggarwal 2020-11-09 15:07:19 -08:00 committed by GitHub
parent 596b466300
commit 21878bd619
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 389 additions and 105 deletions

View file

@ -47,6 +47,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -51,11 +51,24 @@
#ifndef LIBRARY_LOG_LEVEL #ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/
#ifndef democonfigCLIENT_IDENTIFIER #ifndef democonfigCLIENT_IDENTIFIER
/** /**
* @brief The MQTT client identifier used in this example. Each client identifier * @brief The MQTT client identifier used in this example. Each client identifier
* must be unique so edit as required to ensure no two clients connecting to the * must be unique so edit as required to ensure no two clients connecting to the
@ -115,26 +128,26 @@
*/ */
#define democonfigROOT_CA_PEM \ #define democonfigROOT_CA_PEM \
"-----BEGIN CERTIFICATE-----\n"\ "-----BEGIN CERTIFICATE-----\n" \
"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\n" \
"rqXRfboQnoZsG4q5WTP468SQvvG5\n"\ "rqXRfboQnoZsG4q5WTP468SQvvG5\n" \
"-----END CERTIFICATE-----" "-----END CERTIFICATE-----"
/** /**
* @brief Client certificate. * @brief Client certificate.

View file

@ -44,6 +44,17 @@
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -47,6 +47,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -51,6 +51,18 @@
#ifndef LIBRARY_LOG_LEVEL #ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -49,6 +49,17 @@
#define LIBRARY_LOG_LEVEL LOG_NONE #define LIBRARY_LOG_LEVEL LOG_NONE
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -49,6 +49,18 @@
#ifndef LIBRARY_LOG_LEVEL #ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -49,6 +49,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -48,6 +48,18 @@
#ifndef LIBRARY_LOG_LEVEL #ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -47,6 +47,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -51,6 +51,18 @@
#ifndef LIBRARY_LOG_LEVEL #ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -49,6 +49,17 @@
#define LIBRARY_LOG_LEVEL LOG_NONE #define LIBRARY_LOG_LEVEL LOG_NONE
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -49,6 +49,18 @@
#ifndef LIBRARY_LOG_LEVEL #ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -49,6 +49,17 @@
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -49,6 +49,18 @@
#ifndef LIBRARY_LOG_LEVEL #ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -47,6 +47,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -56,6 +56,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/** /**

View file

@ -51,6 +51,18 @@
#ifndef LIBRARY_LOG_LEVEL #ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO #define LIBRARY_LOG_LEVEL LOG_INFO
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -56,6 +56,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/** /**
@ -69,29 +80,29 @@
#define PKCS11_FREE vPortFree #define PKCS11_FREE vPortFree
/** /**
* @brief PKCS #11 default user PIN. * @brief PKCS #11 default user PIN.
* *
* The PKCS #11 standard specifies the presence of a user PIN. That feature is * The PKCS #11 standard specifies the presence of a user PIN. That feature is
* sensible for applications that have an interactive user interface and memory * sensible for applications that have an interactive user interface and memory
* protections. However, since typical microcontroller applications lack one or * protections. However, since typical microcontroller applications lack one or
* both of those, the user PIN is assumed to be used herein for interoperability * both of those, the user PIN is assumed to be used herein for interoperability
* purposes only, and not as a security feature. * purposes only, and not as a security feature.
* *
* Note: Do not cast this to a pointer! The library calls sizeof to get the length * Note: Do not cast this to a pointer! The library calls sizeof to get the length
* of this string. * of this string.
*/ */
#define configPKCS11_DEFAULT_USER_PIN "0000" #define configPKCS11_DEFAULT_USER_PIN "0000"
/** /**
* @brief Maximum length (in characters) for a PKCS #11 CKA_LABEL * @brief Maximum length (in characters) for a PKCS #11 CKA_LABEL
* attribute. * attribute.
*/ */
#define pkcs11configMAX_LABEL_LENGTH 32 #define pkcs11configMAX_LABEL_LENGTH 32
/** /**
* @brief Maximum number of token objects that can be stored * @brief Maximum number of token objects that can be stored
* by the PKCS #11 module. * by the PKCS #11 module.
*/ */
#define pkcs11configMAX_NUM_OBJECTS 6 #define pkcs11configMAX_NUM_OBJECTS 6
/** /**
@ -101,73 +112,73 @@
#define pkcs11configMAX_SESSIONS 10 #define pkcs11configMAX_SESSIONS 10
/** /**
* @brief Set to 1 if a PAL destroy object is implemented. * @brief Set to 1 if a PAL destroy object is implemented.
* *
* If set to 0, no PAL destroy object is implemented, and this functionality * If set to 0, no PAL destroy object is implemented, and this functionality
* is implemented in the common PKCS #11 layer. * is implemented in the common PKCS #11 layer.
*/ */
#define pkcs11configPAL_DESTROY_SUPPORTED 0 #define pkcs11configPAL_DESTROY_SUPPORTED 0
/** /**
* @brief Set to 1 if OTA image verification via PKCS #11 module is supported. * @brief Set to 1 if OTA image verification via PKCS #11 module is supported.
* *
* If set to 0, OTA code signing certificate is built in via * If set to 0, OTA code signing certificate is built in via
* aws_ota_codesigner_certificate.h. * aws_ota_codesigner_certificate.h.
*/ */
#define pkcs11configOTA_SUPPORTED 0 #define pkcs11configOTA_SUPPORTED 0
/** /**
* @brief Set to 1 if PAL supports storage for JITP certificate, * @brief Set to 1 if PAL supports storage for JITP certificate,
* code verify certificate, and trusted server root certificate. * code verify certificate, and trusted server root certificate.
* *
* If set to 0, PAL does not support storage mechanism for these, and * If set to 0, PAL does not support storage mechanism for these, and
* they are accessed via headers compiled into the code. * they are accessed via headers compiled into the code.
*/ */
#define pkcs11configJITP_CODEVERIFY_ROOT_CERT_SUPPORTED 0 #define pkcs11configJITP_CODEVERIFY_ROOT_CERT_SUPPORTED 0
/** /**
* @brief The PKCS #11 label for device private key. * @brief The PKCS #11 label for device private key.
* *
* Private key for connection to AWS IoT endpoint. The corresponding * Private key for connection to AWS IoT endpoint. The corresponding
* public key should be registered with the AWS IoT endpoint. * public key should be registered with the AWS IoT endpoint.
*/ */
#define pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS "Device Priv TLS Key" #define pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS "Device Priv TLS Key"
/** /**
* @brief The PKCS #11 label for device public key. * @brief The PKCS #11 label for device public key.
* *
* The public key corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS. * The public key corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
*/ */
#define pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS "Device Pub TLS Key" #define pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS "Device Pub TLS Key"
/** /**
* @brief The PKCS #11 label for the device certificate. * @brief The PKCS #11 label for the device certificate.
* *
* Device certificate corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS. * Device certificate corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
*/ */
#define pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS "Device Cert" #define pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS "Device Cert"
/** /**
* @brief The PKCS #11 label for the object to be used for code verification. * @brief The PKCS #11 label for the object to be used for code verification.
* *
* Used by over-the-air update code to verify an incoming signed image. * Used by over-the-air update code to verify an incoming signed image.
*/ */
#define pkcs11configLABEL_CODE_VERIFICATION_KEY "Code Verify Key" #define pkcs11configLABEL_CODE_VERIFICATION_KEY "Code Verify Key"
/** /**
* @brief The PKCS #11 label for Just-In-Time-Provisioning. * @brief The PKCS #11 label for Just-In-Time-Provisioning.
* *
* The certificate corresponding to the issuer of the device certificate * The certificate corresponding to the issuer of the device certificate
* (pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS) when using the JITR or * (pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS) when using the JITR or
* JITP flow. * JITP flow.
*/ */
#define pkcs11configLABEL_JITP_CERTIFICATE "JITP Cert" #define pkcs11configLABEL_JITP_CERTIFICATE "JITP Cert"
/** /**
* @brief The PKCS #11 label for the AWS Trusted Root Certificate. * @brief The PKCS #11 label for the AWS Trusted Root Certificate.
* *
* @see aws_default_root_certificates.h * @see aws_default_root_certificates.h
*/ */
#define pkcs11configLABEL_ROOT_CERTIFICATE "Root Cert" #define pkcs11configLABEL_ROOT_CERTIFICATE "Root Cert"
#endif /* _CORE_PKCS11_CONFIG_H_ */ #endif /* _CORE_PKCS11_CONFIG_H_ */

View file

@ -53,6 +53,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -48,6 +48,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -51,6 +51,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -43,6 +43,17 @@
#define LIBRARY_LOG_LEVEL LOG_ERROR #define LIBRARY_LOG_LEVEL LOG_ERROR
#endif #endif
/* Prototype for the function used to print to console on Windows simulator
* of FreeRTOS.
* The function prints to the console before the network is connected;
* then a UDP port after the network has connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Map the SdkLog macro to the logging function to enable logging
* on Windows simulator. */
#define SdkLog( message ) vLoggingPrintf message
#include "logging_stack.h" #include "logging_stack.h"
/************ End of logging configuration ****************/ /************ End of logging configuration ****************/

View file

@ -27,11 +27,11 @@
/** /**
* @file logging_levels.h * @file logging_levels.h
* @brief Defines the logging level macros. * @brief Defines the configuration constants for all logging verbosity levels.
*/ */
#ifndef LOGGING_LEVELS_H_ #ifndef LOGGING_LEVELS_H
#define LOGGING_LEVELS_H_ #define LOGGING_LEVELS_H
/** /**
* @constantspage{logging,logging library} * @constantspage{logging,logging library}
@ -111,4 +111,4 @@
*/ */
#define LOG_DEBUG 4 #define LOG_DEBUG 4
#endif /* ifndef LOGGING_LEVELS_H_ */ #endif /* ifndef LOGGING_LEVELS_H */

View file

@ -27,35 +27,59 @@
/** /**
* @file logging_stack.h * @file logging_stack.h
* @brief Reference implementation of Logging stack as a header-only library. * @brief Utility header file that exposes macros for configuring logging implementation of logging macros (LogError, LogWarn, LogInfo, LogDebug).
*/ */
#ifndef LOGGING_STACK_H_ #ifndef LOGGING_STACK_H
#define LOGGING_STACK_H_ #define LOGGING_STACK_H
/* Include header for logging level macros. */ /* Include header for logging level macros. */
#include "logging_levels.h" #include "logging_levels.h"
/* Standard Include. */ /* Standard Include. */
#include <stdio.h>
#include <stdint.h> #include <stdint.h>
/**
* @brief The name of the library or demo to add as metadata in log messages
* from the library or demo.
*
* This metadata aids in identifying the module source of log messages.
* The metadata is logged in the format `[ <LIBRARY-NAME> ]` as a prefix to the
* log messages.
* Refer to #LOG_METADATA_FORMAT for the complete format of the metadata prefix in
* log messages.
*/
/* Check if LIBRARY_LOG_NAME macro has been defined. */
#if !defined( LIBRARY_LOG_NAME )
#error "Please define LIBRARY_LOG_NAME for the library."
#endif
/* Metadata information to prepend to every log message. */ /* Metadata information to prepend to every log message. */
#define LOG_METADATA_FORMAT "[%s:%d] " #ifndef LOG_METADATA_FORMAT
#define LOG_METADATA_ARGS __FUNCTION__, __LINE__ #define LOG_METADATA_FORMAT "[%s:%d] " /**< @brief Format of metadata prefix in log messages. */
#endif
/* Common macro for all logging interface macros. */ #ifndef LOG_METADATA_ARGS
#if !defined( DISABLE_LOGGING ) #define LOG_METADATA_ARGS __FUNCTION__, __LINE__ /**< @brief Arguments into the metadata logging prefix format. */
#endif
/* Prototype for the function used to print out. In this case it prints to the /**
* console before the network is connected then a UDP port after the network has * @brief Common macro that maps all the logging interfaces,
* connected. */ * (#LogDebug, #LogInfo, #LogWarn, #LogError) to the platform-specific logging
extern void vLoggingPrintf( const char * pcFormatString, * function.
... ); *
#define SdkLog( string ) vLoggingPrintf string * @note The default definition of the macro is an empty definition that does not
#else * generate any logging.
*/
#ifndef SdkLog
#define SdkLog( string ) #define SdkLog( string )
#endif #endif
/**
* Disable definition of logging interface macros when generating doxygen output,
* to avoid conflict with documentation of macros at the end of the file.
*/
/* Check that LIBRARY_LOG_LEVEL is defined and has a valid value. */ /* Check that LIBRARY_LOG_LEVEL is defined and has a valid value. */
#if !defined( LIBRARY_LOG_LEVEL ) || \ #if !defined( LIBRARY_LOG_LEVEL ) || \
( ( LIBRARY_LOG_LEVEL != LOG_NONE ) && \ ( ( LIBRARY_LOG_LEVEL != LOG_NONE ) && \
@ -64,8 +88,6 @@
( LIBRARY_LOG_LEVEL != LOG_INFO ) && \ ( LIBRARY_LOG_LEVEL != LOG_INFO ) && \
( LIBRARY_LOG_LEVEL != LOG_DEBUG ) ) ( LIBRARY_LOG_LEVEL != LOG_DEBUG ) )
#error "Please define LIBRARY_LOG_LEVEL as either LOG_NONE, LOG_ERROR, LOG_WARN, LOG_INFO, or LOG_DEBUG." #error "Please define LIBRARY_LOG_LEVEL as either LOG_NONE, LOG_ERROR, LOG_WARN, LOG_INFO, or LOG_DEBUG."
#elif !defined( LIBRARY_LOG_NAME )
#error "Please define LIBRARY_LOG_NAME for the library."
#else #else
#if LIBRARY_LOG_LEVEL == LOG_DEBUG #if LIBRARY_LOG_LEVEL == LOG_DEBUG
/* All log level messages will logged. */ /* All log level messages will logged. */
@ -105,4 +127,4 @@
#endif /* if LIBRARY_LOG_LEVEL == LOG_ERROR */ #endif /* if LIBRARY_LOG_LEVEL == LOG_ERROR */
#endif /* if !defined( LIBRARY_LOG_LEVEL ) || ( ( LIBRARY_LOG_LEVEL != LOG_NONE ) && ( LIBRARY_LOG_LEVEL != LOG_ERROR ) && ( LIBRARY_LOG_LEVEL != LOG_WARN ) && ( LIBRARY_LOG_LEVEL != LOG_INFO ) && ( LIBRARY_LOG_LEVEL != LOG_DEBUG ) ) */ #endif /* if !defined( LIBRARY_LOG_LEVEL ) || ( ( LIBRARY_LOG_LEVEL != LOG_NONE ) && ( LIBRARY_LOG_LEVEL != LOG_ERROR ) && ( LIBRARY_LOG_LEVEL != LOG_WARN ) && ( LIBRARY_LOG_LEVEL != LOG_INFO ) && ( LIBRARY_LOG_LEVEL != LOG_DEBUG ) ) */
#endif /* ifndef LOGGING_STACK_H_ */ #endif /* ifndef LOGGING_STACK_H */