nx_server_plugin_sdk 1.0 Server Plugin SDK

Public Member Functions | Public Attributes | List of all members
nx::sdk::LogUtils Struct Reference

`#include <log_utils.h>`

## Public Member Functions
| LogUtils (bool enableOutput, std::string printPrefix)
void | setPrintPrefix (std::string newPrefix)
bool | convertAndOutputStringMap (std::map< std::string, std::string > *outMap, const IStringMap *stringMap, const std::string &caption, int outputIndent=0) const

## Public Attributes
const bool | enableOutput
std::string | printPrefix

## Detailed Description

Plugin utils providing convenience for using NX_PRINT/NX_OUTPUT with their settings (printPrefix string and enableOutput flag) taken from the particular plugin: these settings are stored in this class.

To use this tool in a class, make a field "const nx::sdk::LogUtils logUtils", and add the following lines:

        #undef NX_PRINT_PREFIX
        #define NX_PRINT_PREFIX (this->logUtils.printPrefix)
        #undef NX_DEBUG_ENABLE_OUTPUT
        #define NX_DEBUG_ENABLE_OUTPUT (this->logUtils.enableOutput)
        #include <nx/kit/debug.h>

## Member Function Documentation

## ◆ convertAndOutputStringMap()

bool nx::sdk::LogUtils::convertAndOutputStringMap | ( | std::map< std::string, std::string > * | outMap,
|  | const IStringMap * | stringMap,
|  | const std::string & | caption,
|  | int | outputIndent = `0`
| ) |  | const

Convert IStringMap to an std::map and log via NX_OUTPUT. Errors are printed with NX_PRINT.

Parameters

  caption | To be printed before the map and errors; will be followed by ":".
  outputIndent | Number of spaces to be printed before each line printed with NX_OUTPUT.

Returns
  Whether the map is valid.

The documentation for this struct was generated from the following files:

- src/nx/sdk/helpers/log_utils.h
- src/nx/sdk/helpers/log_utils.cpp