Back to Jetson Inference

Jetson Inference: Logging

docs/html/group__log.html

latest19.8 KB
Original Source

| | Jetson Inference

DNN Vision Library |

Classes | Macros

Logging Utilities Library (jetson-utils)

Message logging with a variable level of output and destinations. More...

|

Classes

| | class | Log | | | Message logging with a variable level of output and destinations. More...
| | |

|

Macros

| | #define | LOG_USAGE_STRING | | | Standard command-line options able to be passed to videoOutput::Create()More...
| | | | #define | GenericLogMessage(level, format, args...) if( level <= Log::GetLevel() ) fprintf(Log::GetFile(), format, ## args) | | | Log a printf-style message with the provided level. More...
| | | | #define | LogError(format, args...) GenericLogMessage(Log::ERROR, LOG_COLOR_RED LOG_LEVEL_PREFIX_ERROR format LOG_COLOR_RESET, ## args) | | | Log a printf-style error message (Log::ERROR) More...
| | | | #define | LogWarning(format, args...) GenericLogMessage(Log::WARNING, LOG_COLOR_YELLOW LOG_LEVEL_PREFIX_WARNING format LOG_COLOR_RESET, ## args) | | | Log a printf-style warning message (Log::WARNING) More...
| | | | #define | LogSuccess(format, args...) GenericLogMessage(Log::SUCCESS, LOG_COLOR_GREEN LOG_LEVEL_PREFIX_SUCCESS format LOG_COLOR_RESET, ## args) | | | Log a printf-style success message (Log::SUCCESS) More...
| | | | #define | LogInfo(format, args...) GenericLogMessage(Log::INFO, LOG_LEVEL_PREFIX_INFO format, ## args) | | | Log a printf-style info message (Log::INFO) More...
| | | | #define | LogVerbose(format, args...) GenericLogMessage(Log::VERBOSE, LOG_LEVEL_PREFIX_VERBOSE format, ## args) | | | Log a printf-style verbose message (Log::VERBOSE) More...
| | | | #define | LogDebug(format, args...) GenericLogMessage(Log::DEBUG, LOG_LEVEL_PREFIX_DEBUG format, ## args) | | | Log a printf-style debug message (Log::DEBUG) More...
| | |

Detailed Description

Message logging with a variable level of output and destinations.


Class Documentation

Log

| class Log |

Message logging with a variable level of output and destinations.

|

Public Types

| | enum | Level {
SILENT =0, ERROR, WARNING, SUCCESS,
INFO, VERBOSE, DEBUG, DEFAULT =VERBOSE
} | | | Defines the logging level of a message, and the threshold used by the logger to either drop or output messages. More...
| | | |

Static Public Member Functions

| | static Level | GetLevel () | | | Get the current logging level. More...
| | | | static void | SetLevel (Level level) | | | Set the current logging level. More...
| | | | static FILE * | GetFile () | | | Get the current log output. More...
| | | | static const char * | GetFilename () | | | Get the filename of the log output. More...
| | | | static void | SetFile (FILE *file) | | | Set the logging output. More...
| | | | static void | SetFile (const char *filename) | | | Set the logging output. More...
| | | | static const char * | Usage () | | | Usage string for command line arguments to Create() More...
| | | | static void | ParseCmdLine (const int argc, char **argv) | | | Parse command line options (see Usage() above) More...
| | | | static void | ParseCmdLine (const commandLine &cmdLine) | | | Parse command line options (see Usage() above) More...
| | | | static const char * | LevelToStr (Level level) | | | Convert a logging level to string. More...
| | | | static Level | LevelFromStr (const char *str) | | | Parse a logging level from a string. More...
| | | |

Static Protected Attributes

| | static Level | mLevel | | | | static FILE * | mFile | | | | static std::string | mFilename | | |

Member Enumeration Documentation

Level

| enum Log::Level |

Defines the logging level of a message, and the threshold used by the logger to either drop or output messages.

Enumerator
SILENT

No messages are output.

| | ERROR |

Major errors that may impact application execution.

| | WARNING |

Warning conditions where the application may be able to proceed in some capacity.

| | SUCCESS |

Successful events (e.g.

the loading or creation of a resource)

| | INFO |

Informational messages that are more important than VERBOSE messages.

| | VERBOSE |

Verbose details about program execution.

| | DEBUG |

Low-level debugging (disabled by default)

| | DEFAULT |

The default level is VERBOSE

|

Member Function Documentation

GetFile()

|

| static FILE* Log::GetFile | ( | | ) | |

| inlinestatic |

Get the current log output.

GetFilename()

|

| static const char* Log::GetFilename | ( | | ) | |

| inlinestatic |

Get the filename of the log output.

This may also return "stdout" or "stderror".

GetLevel()

|

| static Level Log::GetLevel | ( | | ) | |

| inlinestatic |

Get the current logging level.

LevelFromStr()

|

| static Level Log::LevelFromStr | ( | const char * | str | ) | |

| static |

Parse a logging level from a string.

LevelToStr()

|

| static const char* Log::LevelToStr | ( | Level | level | ) | |

| static |

Convert a logging level to string.

ParseCmdLine() [1/2]

|

| static void Log::ParseCmdLine | ( | const commandLine & | cmdLine | ) | |

| static |

Parse command line options (see Usage() above)

ParseCmdLine() [2/2]

|

| static void Log::ParseCmdLine | ( | const int | argc, | | | | char ** | argv | | | ) | | |

| static |

Parse command line options (see Usage() above)

SetFile() [1/2]

|

| static void Log::SetFile | ( | const char * | filename | ) | |

| static |

Set the logging output.

Can be "stdout", "stderr", "log.txt", ect.

SetFile() [2/2]

|

| static void Log::SetFile | ( | FILE * | file | ) | |

| static |

Set the logging output.

This can be a built-in file, like stdout or stderr, or a file that has been opened by the user.

SetLevel()

|

| static void Log::SetLevel | ( | Level | level | ) | |

| inlinestatic |

Set the current logging level.

Usage()

|

| static const char* Log::Usage | ( | | ) | |

| inlinestatic |

Usage string for command line arguments to Create()

Member Data Documentation

mFile

|

| FILE* Log::mFile |

| staticprotected |

mFilename

|

| std::string Log::mFilename |

| staticprotected |

mLevel

|

| Level Log::mLevel |

| staticprotected |

Macro Definition Documentation

GenericLogMessage

| #define GenericLogMessage | ( | | level, | | | | | format, | | | | | args... | | | ) | | if( level <= Log::GetLevel() ) fprintf(Log::GetFile(), format, ## args) |

Log a printf-style message with the provided level.

LOG_USAGE_STRING

| #define LOG_USAGE_STRING |

Value:

"logging arguments: \n" \

" --log-file=FILE output destination file (default is stdout)\n" \

" --log-level=LEVEL message output threshold, one of the following:\n" \

" * silent\n" \

" * error\n" \

" * warning\n" \

" * success\n" \

" * info\n" \

" * verbose (default)\n" \

" * debug\n" \

" --verbose enable verbose logging (same as --log-level=verbose)\n" \

" --debug enable debug logging (same as --log-level=debug)\n\n"

Standard command-line options able to be passed to videoOutput::Create()

LogDebug

| #define LogDebug | ( | | format, | | | | | args... | | | ) | | GenericLogMessage(Log::DEBUG, LOG_LEVEL_PREFIX_DEBUG format, ## args) |

Log a printf-style debug message (Log::DEBUG)

LogError

| #define LogError | ( | | format, | | | | | args... | | | ) | | GenericLogMessage(Log::ERROR, LOG_COLOR_RED LOG_LEVEL_PREFIX_ERROR format LOG_COLOR_RESET, ## args) |

Log a printf-style error message (Log::ERROR)

LogInfo

| #define LogInfo | ( | | format, | | | | | args... | | | ) | | GenericLogMessage(Log::INFO, LOG_LEVEL_PREFIX_INFO format, ## args) |

Log a printf-style info message (Log::INFO)

LogSuccess

| #define LogSuccess | ( | | format, | | | | | args... | | | ) | | GenericLogMessage(Log::SUCCESS, LOG_COLOR_GREEN LOG_LEVEL_PREFIX_SUCCESS format LOG_COLOR_RESET, ## args) |

Log a printf-style success message (Log::SUCCESS)

LogVerbose

| #define LogVerbose | ( | | format, | | | | | args... | | | ) | | GenericLogMessage(Log::VERBOSE, LOG_LEVEL_PREFIX_VERBOSE format, ## args) |

Log a printf-style verbose message (Log::VERBOSE)

LogWarning

| #define LogWarning | ( | | format, | | | | | args... | | | ) | | GenericLogMessage(Log::WARNING, LOG_COLOR_YELLOW LOG_LEVEL_PREFIX_WARNING format LOG_COLOR_RESET, ## args) |

Log a printf-style warning message (Log::WARNING)

  • Generated on Tue Mar 28 2023 14:27:58 for Jetson Inference by 1.8.17