| <!DOCTYPE html> |
| <!-- |
| Copyright 2019 NXP |
| |
| This software is owned or controlled by NXP and may only be used |
| strictly in accordance with the applicable license terms. By expressly |
| accepting such terms or by downloading, installing, activating and/or |
| otherwise using the software, you are agreeing that you have read, and |
| that you agree to comply with and are bound by, such license terms. If |
| you do not agree to be bound by the applicable license terms, then you |
| may not retain, install, activate or otherwise use the software. |
| --> |
| |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <meta charset="utf-8" /> |
| <title>3.7. Logging — Plug & Trust MW v03.00.05 documentation</title> |
| <link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" /> |
| <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" /> |
| <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> |
| <script src="../_static/jquery.js"></script> |
| <script src="../_static/underscore.js"></script> |
| <script src="../_static/doctools.js"></script> |
| <script src="../_static/language_data.js"></script> |
| <link rel="index" title="Index" href="../genindex.html" /> |
| <link rel="search" title="Search" href="../search.html" /> |
| <link rel="next" title="3.8. Feature File - fsl_sss_ftr.h" href="feature-file.html" /> |
| <link rel="prev" title="3.6. I2CM / Secure Sensor" href="i2cm.html" /> |
| <meta charset='utf-8'> |
| <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> |
| <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'> |
| <meta name="apple-mobile-web-app-capable" content="yes"> |
| <script type="text/javascript" src="../_static/js/jquery-1.11.0.min.js "></script> |
| <script type="text/javascript" src="../_static/js/jquery-fix.js "></script> |
| <script type="text/javascript" src="../_static/bootstrap-3.3.7/js/bootstrap.min.js "></script> |
| <script type="text/javascript" src="../_static/bootstrap-sphinx.js "></script> |
| |
| </head><body> |
| |
| <div id="navbar" class="navbar navbar-inverse navbar-default navbar-fixed-top"> |
| <div class="container"> |
| <div class="navbar-header"> |
| <!-- .btn-navbar is used as the toggle for collapsed navbar content --> |
| <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <a class="navbar-brand" href="../toc.html"><span><img src="../_static/NXP_logo_JPG.jpg"></span> |
| MW</a> |
| <span class="navbar-text navbar-version pull-left"><b>v03.00.05</b></span> |
| </div> |
| |
| <div class="collapse navbar-collapse nav-collapse"> |
| <ul class="nav navbar-nav"> |
| |
| |
| <li class="dropdown globaltoc-container"> |
| <a role="button" |
| id="dLabelGlobalToc" |
| data-toggle="dropdown" |
| data-target="#" |
| href="../toc.html">TOC <b class="caret"></b></a> |
| <ul class="dropdown-menu globaltoc" |
| role="menu" |
| aria-labelledby="dLabelGlobalToc"><ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../index.html">1. NXP Plug & Trust Middleware</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../organization-of-documentation.html">1.1. Organization of Documentation</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../folder-structure.html">1.2. Folder Structure</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sw-prerequisites.html">1.3. List of Platform Prerequisites</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../changes/index.html">2. Changes</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/pending.html">2.1. Pending Refactoring items</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/pending.html#known-limitations">2.2. Known limitations</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v03_00_05.html">2.3. Release <code class="docutils literal notranslate"><span class="pre">v03.00.05</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v03_00_04.html">2.4. Release <code class="docutils literal notranslate"><span class="pre">v03.00.04</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v03_00_03.html">2.5. Release <code class="docutils literal notranslate"><span class="pre">v03.00.03</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v03_00_02.html">2.6. Release <code class="docutils literal notranslate"><span class="pre">v03.00.02</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_16_01.html">2.7. Release <code class="docutils literal notranslate"><span class="pre">v02.16.01</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_16_00.html">2.8. Release <code class="docutils literal notranslate"><span class="pre">v02.16.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_15_00.html">2.9. Release <code class="docutils literal notranslate"><span class="pre">v02.15.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_14_00.html">2.10. Release <code class="docutils literal notranslate"><span class="pre">v02.14.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_12_00.html">2.11. Release <code class="docutils literal notranslate"><span class="pre">v02.12.05</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_12_00.html#release-v02-12-04">2.12. Release <code class="docutils literal notranslate"><span class="pre">v02.12.04</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_12_00.html#release-v02-12-03">2.13. Release <code class="docutils literal notranslate"><span class="pre">v02.12.03</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_12_00.html#release-v02-12-02">2.14. Release <code class="docutils literal notranslate"><span class="pre">v02.12.02</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_12_00.html#release-v02-12-01">2.15. Release <code class="docutils literal notranslate"><span class="pre">v02.12.01</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_12_00.html#release-v02-12-00">2.16. Release <code class="docutils literal notranslate"><span class="pre">v02.12.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_11_03.html">2.17. Release <code class="docutils literal notranslate"><span class="pre">v02.11.03</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_11_01.html">2.18. Internal Release <code class="docutils literal notranslate"><span class="pre">v02.11.01</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_11_00.html">2.19. Release <code class="docutils literal notranslate"><span class="pre">v02.11.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_10_00.html">2.20. Release <code class="docutils literal notranslate"><span class="pre">v02.10.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_09_00.html">2.21. Release <code class="docutils literal notranslate"><span class="pre">v02.09.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_07_00.html">2.22. Release <code class="docutils literal notranslate"><span class="pre">v02.07.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_06_00.html">2.23. Release <code class="docutils literal notranslate"><span class="pre">v02.06.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_05_00_to_v02_03_00.html">2.24. Release <code class="docutils literal notranslate"><span class="pre">v02.05.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_05_00_to_v02_03_00.html#release-v02-04-00">2.25. Release <code class="docutils literal notranslate"><span class="pre">v02.04.00</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../changes/v02_05_00_to_v02_03_00.html#release-02-03-00">2.26. Release <code class="docutils literal notranslate"><span class="pre">02.03.00</span></code></a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1 current"><a class="reference internal" href="index.html">3. Plug & Trust MW Stack</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="features.html">3.1. Features</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="features.html#plug-trust-mw-block-diagram">3.2. Plug & Trust MW : Block Diagram</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sss-apis.html">3.3. SSS APIs</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="se05xfeatures.html">3.4. SSS APIs: SE051 vs SE050</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="param_checks.html">3.5. Parameter Check & Conventions</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="i2cm.html">3.6. I2CM / Secure Sensor</a></li> |
| <li class="toctree-l2 current"><a class="current reference internal" href="#">3.7. Logging</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="feature-file.html">3.8. Feature File - <code class="docutils literal notranslate"><span class="pre">fsl_sss_ftr.h</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="platf-scp-from-fs.html">3.9. Using Platform SCP Keys from File System</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="auth/auth-objects.html">3.10. Auth Objects</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="auth/auth-objects-userid.html">3.11. Auth Objects : UserID</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="auth/auth-objects-aeskey.html">3.12. Auth Objects : AESKey</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="auth/auth-objects-eckey.html">3.13. Auth Objects : ECKey</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="key-id-range.html">3.14. Key Id Range and Purpose</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="key-id-range.html#authentication-keys">3.15. Authentication Keys</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="key-id-range.html#trust-provisioned-keyids">3.16. Trust provisioned KeyIDs</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sss/ex/doc/puf-scp03.html">3.17. SCP03 with PUF</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sss/doc/sss_heap_management.html">3.18. SSS Heap Management</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../building/index.html">4. Building / Compiling</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../building/windows.html">4.1. Windows Build</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../building/frdm-k64f-sdk.html">4.2. Import MCUXPresso projects from SDK</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../building/frdm-k64f-cmake.html">4.3. Freedom K64F Build (CMake - Advanced)</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../building/imx6.html">4.4. i.MX Linux Build</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../building/rpi3.html">4.5. Raspberry Pi Build</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../building/cmake.html">4.6. CMake</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../scripts/cmake_options.html">4.7. CMake Options</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../demos/index.html">5. Demo and Examples</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#demo-list">5.1. Demo List</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#sss-api-examples">5.2. SSS API Examples</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#cloud-demos">5.3. Cloud Demos</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#linux-specific-demos">5.4. Linux Specific Demos</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#opc-ua-example">5.5. OPC-UA Example</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#arm-psa-example">5.6. ARM PSA Example</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#se05x-examples">5.7. SE05X Examples</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#openssl-examples">5.8. OpenSSL Examples</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#tests-for-user-crypto">5.9. Tests for User Crypto</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#nxpnfcrdlib-examples">5.10. NXPNFCRDLIB examples</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#ease-of-use-examples">5.11. Ease-of-Use examples</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#semslite-examples">5.12. Semslite examples</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/index.html#puf-examples">5.13. PUF examples</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../edgelock2go-agent.html">6. NXP EdgeLock 2GO Agent</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../nxp_iot_agent/doc/introduction.html">6.1. Introduction</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../nxp_iot_agent/doc/introduction.html#building-and-running-the-edgelock-2go-agent">6.2. Building and running the EdgeLock 2GO agent</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../nxp_iot_agent/doc/introduction.html#datastore-keystore">6.3. Datastore / Keystore</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../nxp_iot_agent/doc/introduction.html#connection-to-the-edgelock-2go-cloud-service">6.4. Connection to the EdgeLock 2GO cloud service</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../nxp_iot_agent/doc/introduction.html#claim-codes">6.5. Claim Codes</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../nxp_iot_agent/doc/edgelock2go_agent_apis.html">6.6. API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../nxp_iot_agent/doc/readme_usage_examples.html">6.7. Usage Examples</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../semslite/doc/index.html">7. SEMS Lite Agent</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../semslite/doc/sems_lite_overview.html">7.1. SEMS Lite Overview (Only for SE051)</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../semslite/doc/sems_lite_package.html">7.2. Update Package</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../semslite/doc/sems_lite_usage.html">7.3. SEMS Lite Agent Usage</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../semslite/doc/sems_lite_mgmt_api.html">7.4. SEMS Lite management APIs</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../semslite/doc/sems_lite_process.html">7.5. SEMS Lite Agent Package Load Process</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../semslite/doc/sems_lite_api.html">7.6. APIs</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../semslite/doc/sems_lite_known_issue.html">7.7. SEMS Lite Known Issue</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../semslite/doc/demo_update.html">7.8. SEMS Lite DEMOs</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../plugins/index.html">8. Plugins / Add-ins</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../sss/plugin/openssl/scripts/readme.html">8.1. Introduction on OpenSSL engine</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sss/plugin/mbedtls/scripts/readme.html">8.2. Introduction on mbedTLS ALT Implementation</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sss/plugin/psa/Readme.html">8.3. Platform Security Architecture</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../plugins/akm.html">8.4. Android Key master</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sss/plugin/open62541/readme.html">8.5. Introduction on Open62541 (OPC UA stack)</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../plugins/wifiEAP/wifiEAP.html">8.6. WiFi EAP Demo with Raspberry Pi3</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../plugins/pkcs11.html">8.7. PKCS#11 Standalone Library</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../cli-tool.html">9. CLI Tool</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../pycli/doc/introduction.html">9.1. Introduction</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../pycli/doc/block-diagram.html">9.2. Block Diagram</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../pycli/doc/pre-steps.html">9.3. Steps needed before running <code class="docutils literal notranslate"><span class="pre">ssscli</span></code> tool</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../pycli/doc/running.html">9.4. Running the <code class="docutils literal notranslate"><span class="pre">ssscli</span></code> tool - Windows</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../pycli/Provisioning/readme.html">9.5. CLI Provisioning</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../pycli/doc/readme_usage_examples.html">9.6. Usage Examples</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../pycli/doc/cli_commands_list.html">9.7. List of <code class="docutils literal notranslate"><span class="pre">ssscli</span></code> commands</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../pycli/doc/cli_data_format.html">9.8. CLI Data formats</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../pycli/doc/cli_object_policy.html">9.9. Object Policies Through ssscli</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/upload_se05x_using_pycli.html">9.10. Upload keys and certificates to SE05X using ssscli tool</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../a71ch.html">10. A71CH</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../a71ch/a71ch_sss.html">10.1. A71CH and SSS API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../a71ch/a71ch_miscellaneous.html">10.2. Miscellaneous</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../a71ch/a71ch_legacy_host_api.html">10.3. A71CH Legacy API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../a71ch/a71ch_legacy_hlse_api.html">10.4. A71CH Legacy HLSE (Generic) API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../a71ch/a71ch_configure_tool.html">10.5. A71CH Legacy Configure Tool</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../appendix.html">11. Appendix</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/glossary.html">11.1. Glossary</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/vcom.html">11.2. APDU Commands over VCOM</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/vs2019-setup.html">11.3. Visual Studio 2019 Setup</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/ide_mcux.html">11.4. Setting up MCUXPresso IDE</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../dev-platforms.html">11.5. Development Platforms</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/se_uid.html">11.6. How to get SE Platform Information and UID</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/version_info.html">11.7. Version Information</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../demos/Certificate_Chains/Readme.html">11.8. Certificate Chains</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/rjct_server.html">11.9. JRCP_v1 Server</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/platfscp.html">11.10. Using own Platform SCP03 Keys</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../appendix/apdu_write_to_buffer.html">11.11. Write APDU to buffer</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../api/api_list.html">11.12. Plug & Trust MW APIs</a></li> |
| </ul> |
| </li> |
| </ul> |
| </ul> |
| </li> |
| |
| <li class="dropdown"> |
| <a role="button" |
| id="dLabelLocalToc" |
| data-toggle="dropdown" |
| data-target="#" |
| href="#">Page <b class="caret"></b></a> |
| <ul class="dropdown-menu localtoc" |
| role="menu" |
| aria-labelledby="dLabelLocalToc"><ul> |
| <li><a class="reference internal" href="#">3.7. Logging</a><ul> |
| <li><a class="reference internal" href="#logging-level">3.7.1. Logging level</a></li> |
| <li><a class="reference internal" href="#adding-log-messages-into-the-source-code">3.7.2. Adding log messages into the source code</a></li> |
| <li><a class="reference internal" href="#logging-apis">3.7.3. Logging APIs</a><ul> |
| <li><a class="reference internal" href="#logging-information">3.7.3.1. Logging - Information</a></li> |
| <li><a class="reference internal" href="#logging-variable-names">3.7.3.2. Logging - Variable Names</a></li> |
| <li><a class="reference internal" href="#logging-arrays">3.7.3.3. Logging - Arrays</a></li> |
| <li><a class="reference internal" href="#logging-levels">3.7.3.4. Logging - Levels</a></li> |
| </ul> |
| </li> |
| <li><a class="reference internal" href="#logging-header-files">3.7.4. Logging Header Files</a></li> |
| <li><a class="reference internal" href="#changing-logging-level">3.7.5. Changing logging level</a><ul> |
| <li><a class="reference internal" href="#full-source-code">3.7.5.1. Full source-code</a></li> |
| <li><a class="reference internal" href="#logging-at-component-level">3.7.5.2. Logging at component level</a></li> |
| <li><a class="reference internal" href="#individual-files">3.7.5.3. Individual files</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </ul> |
| </li> |
| |
| |
| |
| |
| |
| <li> |
| <a href="i2cm.html" title="Previous Chapter: 3.6. I2CM / Secure Sensor"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« 3.6. I2CM / S...</span> |
| </a> |
| </li> |
| <li> |
| <a href="feature-file.html" title="Next Chapter: 3.8. Feature File - fsl_sss_ftr.h"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">3.8. Feature ... »</span> |
| </a> |
| </li> |
| |
| |
| |
| |
| |
| </ul> |
| |
| |
| |
| </div> |
| </div> |
| </div> |
| |
| <div class="container"> |
| <div class="row"> |
| <div class="col-md-3"> |
| <div id="sidebar" class="bs-sidenav" role="complementary"> |
| |
| <div class="sidebar-header"> |
| <h3>Plug & Trust MW</h3> |
| </div> |
| |
| <div class="row"> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../index.html">1. NXP Plug & Trust Middleware</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../changes/index.html">2. Changes</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="index.html">3. Plug & Trust MW Stack</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="features.html">3.1. Features</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="features.html#plug-trust-mw-block-diagram">3.2. Plug & Trust MW : Block Diagram</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sss-apis.html">3.3. SSS APIs</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="se05xfeatures.html">3.4. SSS APIs: SE051 vs SE050</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="param_checks.html">3.5. Parameter Check & Conventions</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="i2cm.html">3.6. I2CM / Secure Sensor</a></li> |
| <li class="toctree-l2 current"><a class="current reference internal" href="#">3.7. Logging</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#logging-level">3.7.1. Logging level</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#adding-log-messages-into-the-source-code">3.7.2. Adding log messages into the source code</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#logging-apis">3.7.3. Logging APIs</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#logging-header-files">3.7.4. Logging Header Files</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#changing-logging-level">3.7.5. Changing logging level</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="feature-file.html">3.8. Feature File - <code class="docutils literal notranslate"><span class="pre">fsl_sss_ftr.h</span></code></a></li> |
| <li class="toctree-l2"><a class="reference internal" href="platf-scp-from-fs.html">3.9. Using Platform SCP Keys from File System</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="auth/auth-objects.html">3.10. Auth Objects</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="auth/auth-objects-userid.html">3.11. Auth Objects : UserID</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="auth/auth-objects-aeskey.html">3.12. Auth Objects : AESKey</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="auth/auth-objects-eckey.html">3.13. Auth Objects : ECKey</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="key-id-range.html">3.14. Key Id Range and Purpose</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="key-id-range.html#authentication-keys">3.15. Authentication Keys</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="key-id-range.html#trust-provisioned-keyids">3.16. Trust provisioned KeyIDs</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sss/ex/doc/puf-scp03.html">3.17. SCP03 with PUF</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sss/doc/sss_heap_management.html">3.18. SSS Heap Management</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../building/index.html">4. Building / Compiling</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../demos/index.html">5. Demo and Examples</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../edgelock2go-agent.html">6. NXP EdgeLock 2GO Agent</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../semslite/doc/index.html">7. SEMS Lite Agent</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../plugins/index.html">8. Plugins / Add-ins</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../cli-tool.html">9. CLI Tool</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../a71ch.html">10. A71CH</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../appendix.html">11. Appendix</a></li> |
| </ul> |
| |
| </div> |
| <div class="row"> |
| <form class="form" action="../search.html" method="get"> |
| <div class="form-group"> |
| <label for="Search">Search:</label> |
| <input type="text" name="q" class="form-control" placeholder="Search" /> |
| </div> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| </div> |
| </div> |
| <div class="body col-md-9 content" role="main"> |
| |
| <div class="section" id="logging"> |
| <span id="stack-logging"></span><h1><span class="section-number">3.7. </span>Logging<a class="headerlink" href="#logging" title="Permalink to this headline">¶</a></h1> |
| <p>In order to efficiently debug and diagnose the Plug & Trust Middleware and its |
| supported use-cases and examples, it supports logging. The logging Framework |
| is written in such a way that embedded platforms are kept in mind and at |
| priority. The choice of logging is done at compile time and not at run time |
| like other high-level languages.</p> |
| <div class="section" id="logging-level"> |
| <span id="id1"></span><h2><span class="section-number">3.7.1. </span>Logging level<a class="headerlink" href="#logging-level" title="Permalink to this headline">¶</a></h2> |
| <p>The logging is divided into following levels:</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Error</dt> |
| <dd class="field-odd"><p>Some kind of unrecoverable or unexpected error has happened and the |
| behaviour from this point on is most likely to be out of |
| specifications/expectations. The suffix for this in <a class="reference internal" href="#logging-api"><span class="std std-ref">Logging APIs</span></a> is |
| <strong>E</strong>.</p> |
| </dd> |
| <dt class="field-even">Warn</dt> |
| <dd class="field-even"><p>Whatever happened is unexpected but not fatal, the severity of the |
| warning requires the judgement of the user. The suffix for this in |
| <a class="reference internal" href="#logging-api"><span class="std std-ref">Logging APIs</span></a> is <strong>W</strong>.</p> |
| </dd> |
| <dt class="field-odd">Info</dt> |
| <dd class="field-odd"><p>This is information for the user. The suffix for this in |
| <a class="reference internal" href="#logging-api"><span class="std std-ref">Logging APIs</span></a> is <strong>I</strong>.</p> |
| </dd> |
| <dt class="field-even">Debug</dt> |
| <dd class="field-even"><p>These are verbose low level diagnostic debug messages and not to be |
| used/enabled in normal circumstances. The suffix for this in |
| <a class="reference internal" href="#logging-api"><span class="std std-ref">Logging APIs</span></a> is <strong>D</strong>.</p> |
| </dd> |
| </dl> |
| </div> |
| <div class="section" id="adding-log-messages-into-the-source-code"> |
| <h2><span class="section-number">3.7.2. </span>Adding log messages into the source code<a class="headerlink" href="#adding-log-messages-into-the-source-code" title="Permalink to this headline">¶</a></h2> |
| <ol class="arabic"> |
| <li><p>Add one of <a class="reference internal" href="#logging-header-files"><span class="std std-ref">Logging Header Files</span></a> to the <code class="docutils literal notranslate"><span class="pre">C</span></code> source code.</p> |
| <div class="admonition warning"> |
| <p class="admonition-title">Warning</p> |
| <p>Only for <code class="docutils literal notranslate"><span class="pre">C</span></code> source code. |
| Never add the logging files to header files, only add them |
| to <code class="docutils literal notranslate"><span class="pre">C</span></code> source code.</p> |
| </div> |
| </li> |
| <li><p>Call applicable <a class="reference internal" href="#logging-api"><span class="std std-ref">Logging APIs</span></a> at respective <a class="reference internal" href="#logging-level"><span class="std std-ref">Logging level</span></a></p></li> |
| <li><p>Re-compile and re-run the software.</p></li> |
| </ol> |
| </div> |
| <div class="section" id="logging-apis"> |
| <span id="logging-api"></span><h2><span class="section-number">3.7.3. </span>Logging APIs<a class="headerlink" href="#logging-apis" title="Permalink to this headline">¶</a></h2> |
| <p>The following are the loggings APIs to be called from the source code.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">LOG_I(…)</dt> |
| <dd class="field-odd"><p>Log any value. C language format specifiers and values can be used if needed.</p> |
| </dd> |
| <dt class="field-even">LOG_X8_I(VALUE)</dt> |
| <dd class="field-even"><p>Log a HEX number 8 bits wide</p> |
| </dd> |
| <dt class="field-odd">LOG_U8_I(VALUE)</dt> |
| <dd class="field-odd"><p>Log an unsigned decimal number 8 bits wide</p> |
| </dd> |
| <dt class="field-even">LOG_X16_I(VALUE)</dt> |
| <dd class="field-even"><p>Log a HEX number 16 bits wide</p> |
| </dd> |
| <dt class="field-odd">LOG_U16_I(VALUE)</dt> |
| <dd class="field-odd"><p>Log a unsigned decimal number 16 bits wide</p> |
| </dd> |
| <dt class="field-even">LOG_X32_I(VALUE)</dt> |
| <dd class="field-even"><p>Log a HEX number 32 bits wide</p> |
| </dd> |
| <dt class="field-odd">LOG_U32_I(VALUE)</dt> |
| <dd class="field-odd"><p>Log an unsigned number 32 bits wide</p> |
| </dd> |
| <dt class="field-even">LOG_AU8_I(ARRAY, LEN)</dt> |
| <dd class="field-even"><p>Log an array of 8bits of length LEN</p> |
| </dd> |
| <dt class="field-odd">LOG_MAU8_I(MESSAGE, ARRAY, LEN)</dt> |
| <dd class="field-odd"><p>Same as <code class="samp docutils literal notranslate"><span class="pre">LOG_AU8_I</span></code>, but use MESSAGE.</p> |
| </dd> |
| </dl> |
| <ul class="simple"> |
| <li><p>The logging APIs effectively use preprocessor directives like <code class="samp docutils literal notranslate"><span class="pre">#</span></code> and |
| <code class="samp docutils literal notranslate"><span class="pre">##</span></code> and therefore, if the variable names are verbose enough, API |
| calls like <code class="samp docutils literal notranslate"><span class="pre">LOG_X16_I(statusOfDeleteKey)</span></code> are enough to log response |
| with relevent information, and efficient for the developer to add a logging |
| instruction.</p></li> |
| <li><p>The suffix <code class="samp docutils literal notranslate"><span class="pre">_I</span></code> can be replaced with <code class="samp docutils literal notranslate"><span class="pre">_E</span></code>, <code class="samp docutils literal notranslate"><span class="pre">_W</span></code> or |
| <code class="samp docutils literal notranslate"><span class="pre">_D</span></code> based on <a class="reference internal" href="#logging-level"><span class="std std-ref">Logging level</span></a>. The convention of logging remains |
| the same.</p></li> |
| <li><p>Use HEX Values to log enums and other hexadecimal numbers. For items that |
| are not treated as HEX (e.g. length), use the decimal logging APIs.</p></li> |
| </ul> |
| <p>For example, the APIs can be called as below.</p> |
| <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">retStatus</span> <span class="o">=</span> <span class="n">DoAPDUTxRx_Case3</span><span class="p">(</span> <span class="cm">/* ..., */</span> |
| <span class="n">rspbuf</span><span class="p">,</span> |
| <span class="o">&</span><span class="n">rspbufLen</span><span class="p">);</span> |
| <span class="n">LOG_X16_D</span><span class="p">(</span><span class="n">retStatus</span><span class="p">);</span> |
| <span class="n">LOG_AU8_D</span><span class="p">(</span><span class="n">rspbuf</span><span class="p">,</span> <span class="n">rspbufLen</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <p>If needed, the same can be made more verbose as below.</p> |
| <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">LOG_D</span><span class="p">(</span><span class="s">"Sending FOO Command"</span><span class="p">);</span> |
| <span class="n">retStatus</span> <span class="o">=</span> <span class="n">DoAPDUTxRx_Case3</span><span class="p">(</span> <span class="cm">/* ..., */</span> |
| <span class="n">rspbuf</span><span class="p">,</span> |
| <span class="o">&</span><span class="n">rspbufLen</span><span class="p">);</span> |
| |
| <span class="n">LOG_D</span><span class="p">(</span><span class="s">"FOO retStatus=0x04X"</span><span class="p">,</span> <span class="n">rtStatus</span><span class="p">);</span> |
| <span class="n">LOG_MAU8_D</span><span class="p">(</span><span class="s">"FOO Command"</span><span class="p">,</span> <span class="n">rspbuf</span><span class="p">,</span> <span class="n">rspbufLen</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <div class="section" id="logging-information"> |
| <h3><span class="section-number">3.7.3.1. </span>Logging - Information<a class="headerlink" href="#logging-information" title="Permalink to this headline">¶</a></h3> |
| <p>Code:</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">uint32_t</span> <span class="n">xu32val</span><span class="o">=</span><span class="mh">0x12341234u</span><span class="p">;</span> |
| <span class="kt">uint8_t</span> <span class="n">xu8val</span><span class="o">=</span><span class="mh">0x44</span><span class="p">;</span> |
| |
| <span class="n">LOG_I</span><span class="p">(</span><span class="s">"Values are xu32val=0x%08X xu8val=0x%02X"</span><span class="p">,</span> <span class="n">xu32val</span><span class="p">,</span> <span class="n">xu8val</span><span class="p">);</span> |
| |
| </pre></div> |
| </div> |
| <p>Output:</p> |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span> App:INFO :Values are xu32val=0x12341234 xu8val=0x44 |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="logging-variable-names"> |
| <h3><span class="section-number">3.7.3.2. </span>Logging - Variable Names<a class="headerlink" href="#logging-variable-names" title="Permalink to this headline">¶</a></h3> |
| <p>Code:</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span> <span class="kt">uint32_t</span> <span class="n">xu32val</span><span class="o">=</span><span class="mh">0x12341234u</span><span class="p">;</span> |
| <span class="kt">uint8_t</span> <span class="n">xu8val</span><span class="o">=</span><span class="mh">0x44</span><span class="p">;</span> |
| <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">some_int_value</span> <span class="o">=</span> <span class="mi">783</span><span class="p">;</span> |
| <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">some_byte_value</span> <span class="o">=</span> <span class="mi">96</span><span class="p">;</span> |
| |
| <span class="n">LOG_I</span><span class="p">(</span><span class="s">"Values are:"</span><span class="p">);</span> |
| <span class="n">LOG_X8_I</span><span class="p">(</span><span class="n">xu8val</span><span class="p">);</span> |
| <span class="n">LOG_U8_I</span><span class="p">(</span><span class="n">some_byte_value</span><span class="p">);</span> |
| <span class="n">LOG_X16_I</span><span class="p">(</span><span class="n">xu8val</span><span class="p">);</span> |
| <span class="n">LOG_U16_I</span><span class="p">(</span><span class="n">some_byte_value</span><span class="p">);</span> |
| <span class="n">LOG_X32_I</span><span class="p">(</span><span class="n">xu32val</span><span class="p">);</span> |
| <span class="n">LOG_U32_I</span><span class="p">(</span><span class="n">some_int_value</span><span class="p">);</span> |
| |
| <span class="cm">/* Logging that will be mis-intepreted */</span> |
| <span class="n">LOG_X16_I</span><span class="p">(</span><span class="n">some_byte_value</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <p>Output:</p> |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span> App:INFO :Values are: |
| App:INFO :xu8val=0x44 |
| App:INFO :some_byte_value=96 |
| App:INFO :xu8val=0x0044 |
| App:INFO :some_byte_value=96 |
| App:INFO :xu32val=0x12341234 |
| App:INFO :some_int_value=783 |
| App:INFO :some_byte_value=0x0060 |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="logging-arrays"> |
| <h3><span class="section-number">3.7.3.3. </span>Logging - Arrays<a class="headerlink" href="#logging-arrays" title="Permalink to this headline">¶</a></h3> |
| <p>Code:</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="n">some_array</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> |
| <span class="mh">0x5A</span><span class="p">,</span> <span class="mh">0x5B</span><span class="p">,</span> <span class="mh">0x5C</span><span class="p">,</span> <span class="mh">0x5D</span><span class="p">,</span> |
| <span class="mh">0x5E</span><span class="p">,</span> <span class="mh">0x5F</span><span class="p">,</span> <span class="mh">0x60</span><span class="p">,</span> <span class="mh">0x61</span><span class="p">,</span> |
| <span class="mh">0x62</span><span class="p">,</span> <span class="mh">0x63</span><span class="p">,</span> <span class="mh">0x64</span><span class="p">,</span> <span class="mh">0x65</span><span class="p">,</span> |
| <span class="mh">0x66</span><span class="p">,</span> <span class="mh">0x67</span><span class="p">,</span> <span class="mh">0x68</span><span class="p">,</span> <span class="mh">0x69</span><span class="p">,</span> |
| <span class="mh">0x6A</span><span class="p">,</span> <span class="mh">0x6B</span><span class="p">,</span> <span class="mh">0x6C</span><span class="p">,</span> <span class="mh">0x6D</span><span class="p">};</span> |
| <span class="k">const</span> <span class="kt">uint8_t</span> <span class="n">buffer</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> |
| <span class="mh">0x2A</span><span class="p">,</span> <span class="mh">0x2B</span><span class="p">,</span> <span class="mh">0x2C</span><span class="p">,</span> <span class="mh">0x2D</span><span class="p">,</span> |
| <span class="mh">0x2E</span><span class="p">,</span> <span class="mh">0x2F</span><span class="p">,</span> <span class="mh">0x30</span><span class="p">,</span> <span class="mh">0x31</span><span class="p">,</span> |
| <span class="mh">0x32</span><span class="p">,</span> <span class="mh">0x33</span><span class="p">,</span> <span class="mh">0x34</span><span class="p">,</span> <span class="mh">0x35</span><span class="p">,</span> |
| <span class="mh">0x36</span><span class="p">,</span> <span class="mh">0x37</span><span class="p">,</span> <span class="mh">0x38</span><span class="p">,</span> <span class="mh">0x39</span><span class="p">,</span> |
| <span class="mh">0x3A</span><span class="p">,</span> <span class="mh">0x3B</span><span class="p">,</span> <span class="mh">0x3C</span><span class="p">,</span> <span class="mh">0x3D</span><span class="p">,</span> |
| <span class="mh">0x3E</span><span class="p">,</span> <span class="mh">0x3F</span><span class="p">,</span> <span class="mh">0x40</span><span class="p">,</span> <span class="mh">0x41</span><span class="p">,</span> |
| <span class="mh">0x42</span><span class="p">,</span> <span class="mh">0x43</span><span class="p">,</span> <span class="mh">0x44</span><span class="p">,</span> <span class="mh">0x45</span><span class="p">};</span> |
| <span class="n">LOG_AU8_I</span><span class="p">(</span><span class="n">some_array</span><span class="p">,</span> <span class="n">ARRAY_SIZE</span><span class="p">(</span><span class="n">some_array</span><span class="p">));</span> |
| <span class="n">LOG_MAU8_I</span><span class="p">(</span><span class="s">"meaningful name"</span><span class="p">,</span> <span class="n">buffer</span><span class="p">,</span> <span class="n">ARRAY_SIZE</span><span class="p">(</span><span class="n">buffer</span><span class="p">));</span> |
| </pre></div> |
| </div> |
| <p>Output:</p> |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span> App:INFO :some_array (Len=20) |
| 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 |
| 6A 6B 6C 6D |
| App:INFO :meaningful name (Len=28) |
| 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 |
| 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="logging-levels"> |
| <h3><span class="section-number">3.7.3.4. </span>Logging - Levels<a class="headerlink" href="#logging-levels" title="Permalink to this headline">¶</a></h3> |
| <p>Code:</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span> <span class="kt">uint32_t</span> <span class="n">xu32val</span><span class="o">=</span><span class="mh">0x12341234u</span><span class="p">;</span> |
| <span class="n">LOG_X32_D</span><span class="p">(</span><span class="n">xu32val</span><span class="p">);</span> |
| <span class="n">LOG_X32_I</span><span class="p">(</span><span class="n">xu32val</span><span class="p">);</span> |
| <span class="n">LOG_X32_W</span><span class="p">(</span><span class="n">xu32val</span><span class="p">);</span> |
| <span class="n">LOG_X32_E</span><span class="p">(</span><span class="n">xu32val</span><span class="p">);</span> |
| |
| </pre></div> |
| </div> |
| <p>Output:</p> |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span> App:INFO :xu32val=0x12341234 |
| App:WARN :xu32val=0x12341234 |
| App:ERROR:xu32val=0x12341234 |
| </pre></div> |
| </div> |
| </div> |
| </div> |
| <div class="section" id="logging-header-files"> |
| <span id="id2"></span><h2><span class="section-number">3.7.4. </span>Logging Header Files<a class="headerlink" href="#logging-header-files" title="Permalink to this headline">¶</a></h2> |
| <p>Some of the header files for logging are as under.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">nxLog_UseCases.h</dt> |
| <dd class="field-odd"><p>High level use cases.</p> |
| </dd> |
| <dt class="field-even">nxLog_App.h</dt> |
| <dd class="field-even"><p>Applications and tools.</p> |
| </dd> |
| <dt class="field-odd">nxLog_VCOM.h</dt> |
| <dd class="field-odd"><p>Logging specifically for VCOM Layer.</p> |
| </dd> |
| <dt class="field-even">nxLog_sss.h</dt> |
| <dd class="field-even"><p>Logging specifically for SSS Layer.</p> |
| </dd> |
| <dt class="field-odd">nxLog_hostLib.h</dt> |
| <dd class="field-odd"><p>Logging specifically for Host Library Layer.</p> |
| </dd> |
| <dt class="field-even">nxLog_smCom.h</dt> |
| <dd class="field-even"><p>Communication and common layer.</p> |
| </dd> |
| </dl> |
| <p>They can be found at <code class="file docutils literal notranslate"><span class="pre">hostlib/hostLib/libCommon/infra</span></code>. These files are machine generated and hence is is not recommended to hand edit them.</p> |
| </div> |
| <div class="section" id="changing-logging-level"> |
| <h2><span class="section-number">3.7.5. </span>Changing logging level<a class="headerlink" href="#changing-logging-level" title="Permalink to this headline">¶</a></h2> |
| <p>To change the level of logging, the following approaches are |
| valid and based on the need of the problem, they can and |
| should be used.</p> |
| <div class="section" id="full-source-code"> |
| <h3><span class="section-number">3.7.5.1. </span>Full source-code<a class="headerlink" href="#full-source-code" title="Permalink to this headline">¶</a></h3> |
| <p><code class="file docutils literal notranslate"><span class="pre">hostlib/hostLib/libCommon/infra/nxLog_DefaultConfig.h</span></code> can be modified |
| to change logging level. <code class="file docutils literal notranslate"><span class="pre">nxLog_DefaultConfig.h</span></code> is self documented.</p> |
| <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="cm">/* See Plug & Trust Middleware Docuemntation --> stack --> Logging</span> |
| <span class="cm"> for more information */</span> |
| |
| <span class="cm">/*</span> |
| <span class="cm"> * - 1 => Enable Debug level logging - for all.</span> |
| <span class="cm"> * - 0 => Disable Debug level logging. This has to be</span> |
| <span class="cm"> * enabled individually by other logging</span> |
| <span class="cm"> * header/source files */</span> |
| <span class="cp">#define NX_LOG_ENABLE_DEFAULT_DEBUG 0</span> |
| |
| <span class="cm">/* Same as NX_LOG_ENABLE_DEFAULT_DEBUG but for Info Level */</span> |
| <span class="cp">#define NX_LOG_ENABLE_DEFAULT_INFO 1</span> |
| |
| <span class="cm">/* Same as NX_LOG_ENABLE_DEFAULT_DEBUG but for Warn Level */</span> |
| <span class="cp">#define NX_LOG_ENABLE_DEFAULT_WARN 1</span> |
| |
| <span class="cm">/* Same as NX_LOG_ENABLE_DEFAULT_DEBUG but for Error Level.</span> |
| <span class="cm"> * Ideally, this shoudl alwasy be kept enabled */</span> |
| <span class="cp">#define NX_LOG_ENABLE_DEFAULT_ERROR 1</span> |
| |
| |
| <span class="cm">/* Release - retail build */</span> |
| <span class="cp">#ifdef FLOW_SILENT</span> |
| <span class="cp">#undef NX_LOG_ENABLE_DEFAULT_DEBUG</span> |
| <span class="cp">#undef NX_LOG_ENABLE_DEFAULT_INFO</span> |
| <span class="cp">#undef NX_LOG_ENABLE_DEFAULT_WARN</span> |
| <span class="cp">#undef NX_LOG_ENABLE_DEFAULT_ERROR</span> |
| |
| <span class="cp">#define NX_LOG_ENABLE_DEFAULT_DEBUG 0</span> |
| <span class="cp">#define NX_LOG_ENABLE_DEFAULT_INFO 0</span> |
| <span class="cp">#define NX_LOG_ENABLE_DEFAULT_WARN 0</span> |
| <span class="cp">#define NX_LOG_ENABLE_DEFAULT_ERROR 0</span> |
| <span class="cp">#endif</span> |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="logging-at-component-level"> |
| <h3><span class="section-number">3.7.5.2. </span>Logging at component level<a class="headerlink" href="#logging-at-component-level" title="Permalink to this headline">¶</a></h3> |
| <p>For example, changing logging level of <code class="samp docutils literal notranslate"><span class="pre">App</span></code>, |
| <code class="file docutils literal notranslate"><span class="pre">hostlib/hostLib/libCommon/infra/nxLog_App.h</span></code> can be updated. As shown |
| below, in <code class="file docutils literal notranslate"><span class="pre">nxLog_App.h</span></code>, the values of |
| <code class="samp docutils literal notranslate"><span class="pre">NX_LOG_ENABLE_APP_INFO</span></code>, etc. can be updated.</p> |
| <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="cm">/* If source file, or nxLog_Config.h has not set it, set these defines</span> |
| <span class="cm"> *</span> |
| <span class="cm"> * Do not #undef these values, rather set to 0/1. This way we can</span> |
| <span class="cm"> * jump to definition and avoid plain-old-text-search to jump to</span> |
| <span class="cm"> * undef. */</span> |
| |
| <span class="cp">#ifndef NX_LOG_ENABLE_APP_DEBUG</span> |
| <span class="cp"># define NX_LOG_ENABLE_APP_DEBUG (NX_LOG_ENABLE_DEFAULT_DEBUG)</span> |
| <span class="cp">#endif</span> |
| <span class="cp">#ifndef NX_LOG_ENABLE_APP_INFO</span> |
| <span class="cp"># define NX_LOG_ENABLE_APP_INFO (NX_LOG_ENABLE_APP_DEBUG + NX_LOG_ENABLE_DEFAULT_INFO)</span> |
| <span class="cp">#endif</span> |
| <span class="cp">#ifndef NX_LOG_ENABLE_APP_WARN</span> |
| <span class="cp"># define NX_LOG_ENABLE_APP_WARN (NX_LOG_ENABLE_APP_INFO + NX_LOG_ENABLE_DEFAULT_WARN)</span> |
| <span class="cp">#endif</span> |
| <span class="cp">#ifndef NX_LOG_ENABLE_APP_ERROR</span> |
| <span class="cp"># define NX_LOG_ENABLE_APP_ERROR (NX_LOG_ENABLE_APP_WARN + NX_LOG_ENABLE_DEFAULT_ERROR)</span> |
| <span class="cp">#endif</span> |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="individual-files"> |
| <h3><span class="section-number">3.7.5.3. </span>Individual files<a class="headerlink" href="#individual-files" title="Permalink to this headline">¶</a></h3> |
| <p>Rather than applying logging levels to full stack, if the need is to set the |
| logging level in individual files, the individual source file can set required |
| defined before including the respective log file.</p> |
| <p>e.g. The below lines will set log level to maximum:</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#define NX_LOG_ENABLE_APP_DEBUG 1</span> |
| <span class="cp">#include</span> <span class="cpf"><nxLog_App.h></span><span class="cp"></span> |
| </pre></div> |
| </div> |
| <p>e.g. The below lines will set log level to just error:</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#define NX_LOG_ENABLE_APP_DEBUG 0</span> |
| <span class="cp">#define NX_LOG_ENABLE_APP_INFO 0</span> |
| <span class="cp">#define NX_LOG_ENABLE_APP_WARN 0</span> |
| <span class="cp">#define NX_LOG_ENABLE_APP_ERROR 1</span> |
| <span class="cp">#include</span> <span class="cpf"><nxLog_App.h></span><span class="cp"></span> |
| </pre></div> |
| </div> |
| <p><code class="samp docutils literal notranslate"><span class="pre">nxLog_App.h</span></code> and <code class="samp docutils literal notranslate"><span class="pre">_APP_</span></code> needs to be replaced with |
| respective names as per the list in <a class="reference internal" href="#logging-header-files"><span class="std std-ref">Logging Header Files</span></a>.</p> |
| </div> |
| </div> |
| </div> |
| |
| |
| </div> |
| |
| </div> |
| </div> |
| <footer class="footer"> |
| <div class="container"> |
| <p class="pull-right"> |
| <a href="#">Back to top</a> |
| |
| </p> |
| <p> |
| © Copyright 2018-2020, NXP.<br/> |
| Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.4.1.<br/> |
| </p> |
| </div> |
| </footer> |
| </body> |
| </html> |