본문으로 건너뛰기
로딩중...
검색중...
일치하는것 없음
glsLog.h
1#pragma once
2#include "gdk_dll/glsExport.h"
3#include "gdk_dll/glsTypes.h"
4
5#include <cstdint>
6
7// MSVC SAL annotation; expands to nothing on toolchains without <sal.h> (GCC/Clang).
8#ifndef _Printf_format_string_
11#define _Printf_format_string_
12#endif
13
14namespace GDK {
15
20enum class glsLogLevel : int {
21 Error = 0,
22 Warning = 1,
23 Info = 2,
24 Debug = 3,
26};
27
31enum class glsLogMode : int {
32 Sync = 0,
33 Async = 1
34};
35
39enum class glsLogOverflowPolicy : int {
40 Block = 0,
43};
44
59
60// C-ABI callback — same pattern as glsTileReadyCallback (function pointer + userData)
61// line is UTF-8 callback-scope storage; copy it before returning if needed.
69using glsLogCallback = void(*)(glsLogLevel level, const char* line, void* userData);
70
77struct GDK_DLL_API glsLog final {
78 glsLog() = delete;
79
82
86 static glsStatus SetEnabled(bool enabled) noexcept;
90 static glsStatus GetEnabled(bool* outEnabled) noexcept;
94 static glsStatus SetLevel(glsLogLevel level) noexcept;
98 static glsStatus GetLevel(glsLogLevel* outLevel) noexcept;
104 static glsStatus SetMode(glsLogMode mode) noexcept;
108 static glsStatus GetMode(glsLogMode* outMode) noexcept;
112 static glsStatus SetAsyncOptions(const glsLogAsyncOptions* options) noexcept;
116 static glsStatus GetAsyncOptions(glsLogAsyncOptions* outOptions) noexcept;
121 static glsStatus Flush() noexcept;
125 static glsStatus GetDroppedCount(std::uint64_t* outCount) noexcept;
126
128
131
137 static glsStatus SetLogFilePath(const char* pathUtf8) noexcept;
141 static glsStatus SetFileOutputEnabled(bool enabled) noexcept;
142
143 // nullptr callback = remove
150 static glsStatus SetCallback(glsLogCallback callback, void* userData) noexcept;
151
160 _Printf_format_string_ const char* fmt, ...) noexcept;
162};
163
164} // namespace GDK
SDK의 공유 라이브러리 심볼에 적용할 플랫폼별 선언 특성을 정의합니다.
공개 gdk_dll API가 공유하는 값 형식, 결과 코드, 호출 규약입니다.
glsLogMode
파일과 콜백에 로그 줄을 전달하는 방식입니다.
정의 glsLog.h:31
void(*)(glsLogLevel level, const char *line, void *userData) glsLogCallback
glsLog::SetCallback()으로 등록하는 로그 줄 콜백입니다.
정의 glsLog.h:69
glsLogLevel
로그 줄의 심각도 및 SDK 자체 로그의 임곗값입니다.
정의 glsLog.h:20
glsLogOverflowPolicy
비동기 로그 대기열이 가득 찼을 때의 정책입니다.
정의 glsLog.h:39
#define GDK_DLL_API
Windows에서는 SDK 심볼을 내보내거나 가져오고, 그 외 플랫폼에서는 SDK 빌드의 심볼을 공개합니다.
정의 glsExport.h:20
#define _Printf_format_string_
MSVC의 SAL printf 형식 검사를 지원하지 않는 도구에서는 빈 매크로로 대체합니다.
정의 glsLog.h:11
@ Async
SDK의 로그 스레드에서 대기열의 줄을 씁니다.
정의 glsLog.h:33
@ Sync
호출 스레드에서 줄을 쓰고 파일 버퍼를 비웁니다. 기본 방식입니다.
정의 glsLog.h:32
@ Warning
경고까지 포함하는 임곗값입니다.
정의 glsLog.h:22
@ Info
정보까지 포함하는 기본 임곗값입니다.
정의 glsLog.h:23
@ Error
오류 줄만 허용하는 임곗값입니다.
정의 glsLog.h:21
@ Debug
디버그까지 포함하는 임곗값입니다.
정의 glsLog.h:24
@ Verbose
상세 추적을 포함하는 모든 로그를 허용합니다.
정의 glsLog.h:25
@ Block
기록 스레드는 대기열에 자리가 생길 때까지 기다립니다. 로그 스레드 콜백의 재호출에서는 새 줄을 버립니다.
정의 glsLog.h:40
@ DropOldest
대기열의 가장 오래된 줄을 버리는 기본 정책입니다.
정의 glsLog.h:42
@ DropNewest
수신한 새 줄을 버립니다.
정의 glsLog.h:41
glsGdk SDK의 네이티브 C++ API 이름 공간입니다.
정의 glsAttributeTable.h:5
비동기 로깅의 대기열 및 파일 버퍼 정책입니다.
정의 glsLog.h:49
glsLogOverflowPolicy overflowPolicy
대기열이 가득 찼을 때 새 로그 줄을 처리하는 정책입니다.
정의 glsLog.h:53
bool flushOnError
true이면 Error 줄을 쓴 직후 파일 버퍼를 비웁니다.
정의 glsLog.h:57
int queueCapacity
대기열의 최대 줄 수입니다. 0 이하는 1로 처리하며 현재 줄 수보다 낮추면 오래된 줄부터 버립니다.
정의 glsLog.h:51
int flushIntervalMs
새 줄이 없을 때 파일 버퍼를 비우기까지의 밀리초입니다. 0 이하는 1로 처리합니다.
정의 glsLog.h:55
static glsStatus Write(glsLogLevel level, const char *fmt,...) noexcept
printf 형식의 UTF-8 진단 줄을 기록합니다.
static glsStatus GetAsyncOptions(glsLogAsyncOptions *outOptions) noexcept
적용된 비동기 로그 옵션을 조회합니다.
static glsStatus GetDroppedCount(std::uint64_t *outCount) noexcept
프로세스 시작 후 비동기 대기열에서 버린 로그 줄의 누계를 조회합니다.
static glsStatus SetLevel(glsLogLevel level) noexcept
SDK 자체 로그의 임곗값을 설정합니다.
static glsStatus Flush() noexcept
대기열의 로그를 쓰고 파일 버퍼를 비웁니다.
static glsStatus GetEnabled(bool *outEnabled) noexcept
SDK 자체 로깅이 켜져 있는지 조회합니다.
static glsStatus SetLogFilePath(const char *pathUtf8) noexcept
로그 파일 경로를 설정하고 현재 파일 버퍼를 비운 다음 닫습니다.
static glsStatus SetCallback(glsLogCallback callback, void *userData) noexcept
기록하는 모든 줄을 받는 콜백을 설정합니다.
static glsStatus GetMode(glsLogMode *outMode) noexcept
현재 로그 모드를 조회합니다.
static glsStatus SetMode(glsLogMode mode) noexcept
동기와 비동기 모드 사이를 전환합니다.
static glsStatus SetFileOutputEnabled(bool enabled) noexcept
로그 파일에 쓰기를 켜거나 끕니다.
static glsStatus GetLevel(glsLogLevel *outLevel) noexcept
SDK 자체 로그의 임곗값을 조회합니다.
static glsStatus SetEnabled(bool enabled) noexcept
SDK 자체 로깅을 켜거나 끕니다.
static glsStatus SetAsyncOptions(const glsLogAsyncOptions *options) noexcept
비동기 대기열과 파일 버퍼 옵션을 설정합니다.
DLL 경계의 공개 함수가 반환하는 상태입니다.
정의 glsTypes.h:83