Skip to content

[English] METRIC_LOG

Luiz Felipe edited this page Apr 11, 2020 · 2 revisions
METRIC_LOG(format, ...);
METRIC_LOG_ARRAY(mask, array, length);

METRIC_LOG internally use printf() function to print a log message. The usage is the same as the function. You should pass a minimum of 2 arguments to this macro.

The macro METRIC_LOG_ARRAY displays the content of an array, mask is the mask used in the printf call to display an element of the array. length is the number of elements.

Example

#include <stdio.h>
#include "metric.h"

int main(void)
{
  int arr[] = {3, 4, 5, 6, 7};
  
  METRIC_LOG("%s\n", "Just an example...");
  METRIC_LOG_ARRAY("%d", arr, sizeof arr / sizeof *arr);
  return 0;
}

Output:

<LOG> Just an example...
<LOG> arr[5] = {3, 4, 5, 6, 7}