XVector
xvec_log.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2026 XCENA Inc.
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
25 #pragma once
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 #include <stdint.h>
33 
34 #include "xvec_types.h"
35 
39  typedef enum xvecLogLevel
40  {
47 
57  typedef void (*xvecLogSinkFn)(xvecLogLevel logLevel,
58  const char* file,
59  uint32_t line,
60  const char* message,
61  void* userData);
62 
76  xvecStatus xvecSetLogSink(xvecLogSinkFn logSink, void* userData);
77 
91 
98 
106  const char* xvecGetLogLevelString(xvecLogLevel logLevel);
107 
115  const char* xvecGetLogLevelColor(xvecLogLevel logLevel);
116 
117 #ifdef __cplusplus
118 }
119 #endif
xvecLogLevel xvecGetLogLevel(void)
Gets the current runtime log level.
xvecStatus xvecSetLogLevel(xvecLogLevel logLevel)
Sets the minimum log level for runtime filtering.
const char * xvecGetLogLevelColor(xvecLogLevel logLevel)
Gets the ANSI color code for a log level.
const char * xvecGetLogLevelString(xvecLogLevel logLevel)
Gets the string representation of a log level.
xvecLogLevel
Log severity levels.
Definition: xvec_log.h:40
@ XVEC_LOG_LEVEL_WARN
Warning messages for potential issues.
Definition: xvec_log.h:42
@ XVEC_LOG_LEVEL_ERROR
Error messages indicating failures.
Definition: xvec_log.h:41
@ XVEC_LOG_LEVEL_DEBUG
Debug messages for development.
Definition: xvec_log.h:44
@ XVEC_LOG_LEVEL_INFO
Informational messages.
Definition: xvec_log.h:43
@ XVEC_LOG_LEVEL_TRACE
Detailed trace messages.
Definition: xvec_log.h:45
void(* xvecLogSinkFn)(xvecLogLevel logLevel, const char *file, uint32_t line, const char *message, void *userData)
Log sink callback function type.
Definition: xvec_log.h:57
xvecStatus xvecSetLogSink(xvecLogSinkFn logSink, void *userData)
Sets the log sink callback function.
Core types, enums, and structures for the XVector library.
xvecStatus
Status codes returned by XVector API functions.
Definition: xvec_types.h:133