Doxygen Book
nnstreamer_log.c File Reference

Internal log and error handling for NNStreamer plugins and core codes. More...

#include <execinfo.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <glib.h>
#include "nnstreamer_log.h"
Include dependency graph for nnstreamer_log.c:

Go to the source code of this file.

Macros

#define _NNSTREAMER_ERROR_LENGTH   (4096U)
 

Functions

char * _backtrace_to_string (void)
 stack trace as a string for error messages More...
 
 G_LOCK_DEFINE_STATIC (errlock)
 
const char * _nnstreamer_error (void)
 return the last internal error string and clean it. More...
 
 __attribute__ ((__format__(__printf__, 1, 2)))
 overwrites the error message buffer with the new message. More...
 
void _nnstreamer_error_clean (void)
 cleans up the error message buffer. More...
 

Variables

static char errmsg [_NNSTREAMER_ERROR_LENGTH] = { 0 }
 
static int errmsg_reported = 0
 

Detailed Description

Internal log and error handling for NNStreamer plugins and core codes.

Date
31 Mar 2022
See also
http://github.com/nnstreamer/nnstreamer
Author
MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
No known bugs except for NYI items

Definition in file nnstreamer_log.c.

Macro Definition Documentation

◆ _NNSTREAMER_ERROR_LENGTH

#define _NNSTREAMER_ERROR_LENGTH   (4096U)

Definition at line 70 of file nnstreamer_log.c.

Function Documentation

◆ __attribute__()

__attribute__ ( (__format__(__printf__, 1, 2))  )

overwrites the error message buffer with the new message.

The attribute is for clang workaround in macos: https://stackoverflow.com/questions/20167124/vsprintf-and-vsnprintf-wformat-nonliteral-warning-on-clang-5-0

Definition at line 97 of file nnstreamer_log.c.

◆ _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.
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.

◆ G_LOCK_DEFINE_STATIC()

G_LOCK_DEFINE_STATIC ( errlock  )

Variable Documentation

◆ errmsg

char errmsg[_NNSTREAMER_ERROR_LENGTH] = { 0 }
static

Definition at line 71 of file nnstreamer_log.c.

◆ errmsg_reported

int errmsg_reported = 0
static

Definition at line 73 of file nnstreamer_log.c.