Doxygen Book
nnstreamer_log.h File Reference

Internal log util for NNStreamer plugins and native APIs. More...

#include <stdlib.h>
#include <glib.h>
Include dependency graph for nnstreamer_log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TAG_NAME   "nnstreamer"
 
#define ml_logi   g_info
 
#define ml_logw   g_warning
 
#define ml_loge   g_critical
 
#define ml_logd   g_debug
 
#define ml_logf   g_error
 
#define GST_ELEMENT_ERROR_BTRACE(s, errtype, errcode, mesg)
 
#define ml_logf_stacktrace(...)
 
#define ml_log_stacktrace(logfunc, ...)
 
#define ml_loge_stacktrace(...)   ml_log_stacktrace(ml_loge, __VA_ARGS__)
 
#define nns_logi   ml_logi
 
#define nns_logw   ml_logw
 
#define nns_loge   ml_loge
 
#define nns_logd   ml_logd
 
#define nns_logf   ml_logf
 

Functions

char * _backtrace_to_string (void)
 stack trace as a string for error messages More...
 
const char * _nnstreamer_error (void)
 return the last internal error string and clean it. More...
 
void _nnstreamer_error_write (const char *fmt,...)
 overwrites the error message buffer with the new message. More...
 
void _nnstreamer_error_clean (void)
 cleans up the error message buffer. More...
 

Detailed Description

Internal log util for NNStreamer plugins and native APIs.

Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2.1 of the License.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

Date
12 Mar 2020
See also
http://github.com/nnstreamer/nnstreamer
Author
Jaeyun Jung jy121.nosp@m.0.ju.nosp@m.ng@sa.nosp@m.msun.nosp@m.g.com
Bug:
No known bugs except for NYI items

Definition in file nnstreamer_log.h.

Macro Definition Documentation

◆ GST_ELEMENT_ERROR_BTRACE

#define GST_ELEMENT_ERROR_BTRACE (   s,
  errtype,
  errcode,
  mesg 
)
Value:
do { \
char *btrace = _backtrace_to_string (); \
if (btrace) { \
GST_ELEMENT_ERROR (s, errtype, errcode, mesg, ("%s", btrace)); \
free (btrace); \
} \
} while (0)

Definition at line 94 of file nnstreamer_log.h.

◆ ml_log_stacktrace

#define ml_log_stacktrace (   logfunc,
  ... 
)
Value:
do { \
char *btrace = _backtrace_to_string (); \
if (btrace) { \
logfunc ("%s\n", btrace); \
free (btrace); \
} \
logfunc (__VA_ARGS__); \
} while (0)

Definition at line 111 of file nnstreamer_log.h.

◆ ml_logd

#define ml_logd   g_debug

Definition at line 79 of file nnstreamer_log.h.

◆ ml_loge

#define ml_loge   g_critical

Definition at line 78 of file nnstreamer_log.h.

◆ ml_loge_stacktrace

#define ml_loge_stacktrace (   ...)    ml_log_stacktrace(ml_loge, __VA_ARGS__)

Definition at line 119 of file nnstreamer_log.h.

◆ ml_logf

#define ml_logf   g_error

Definition at line 80 of file nnstreamer_log.h.

◆ ml_logf_stacktrace

#define ml_logf_stacktrace (   ...)
Value:
do { \
char *btrace = _backtrace_to_string (); \
if (btrace) { \
ml_loge ("%s\n", btrace); \
free (btrace); \
} \
ml_logf (__VA_ARGS__); \
} while (0)

Definition at line 102 of file nnstreamer_log.h.

◆ ml_logi

#define ml_logi   g_info

Definition at line 76 of file nnstreamer_log.h.

◆ ml_logw

#define ml_logw   g_warning

Definition at line 77 of file nnstreamer_log.h.

◆ nns_logd

#define nns_logd   ml_logd

Definition at line 143 of file nnstreamer_log.h.

◆ nns_loge

#define nns_loge   ml_loge

Definition at line 142 of file nnstreamer_log.h.

◆ nns_logf

#define nns_logf   ml_logf

Definition at line 144 of file nnstreamer_log.h.

◆ nns_logi

#define nns_logi   ml_logi

Definition at line 140 of file nnstreamer_log.h.

◆ nns_logw

#define nns_logw   ml_logw

Definition at line 141 of file nnstreamer_log.h.

◆ TAG_NAME

#define TAG_NAME   "nnstreamer"

Definition at line 28 of file nnstreamer_log.h.

Function Documentation

◆ _backtrace_to_string()

char* _backtrace_to_string ( void  )

stack trace as a string for error messages

Returns
a string of stacktrace result. caller should free it.
a string of stacktrace result. caller should free it.
Todo:
The .c file location of this function might be not appropriate.

Definition at line 35 of file nnstreamer_log.c.

◆ _nnstreamer_error()

const char* _nnstreamer_error ( void  )

return the last internal error string and clean it.

Returns
a string of error. Do not free the returned string.

Definition at line 81 of file nnstreamer_log.c.

Here is the caller graph for this function:

◆ _nnstreamer_error_clean()

void _nnstreamer_error_clean ( void  )

cleans up the error message buffer.

Definition at line 120 of file nnstreamer_log.c.

◆ _nnstreamer_error_write()

void _nnstreamer_error_write ( const char *  fmt,
  ... 
)

overwrites the error message buffer with the new message.

Here is the caller graph for this function:
_backtrace_to_string
char * _backtrace_to_string(void)
stack trace as a string for error messages
Definition: nnstreamer_log.c:35