2024-02-15 19:42:22 +01:00
|
|
|
#pragma once
|
|
|
|
|
2024-02-17 12:55:21 +01:00
|
|
|
#include <stdint.h>
|
2024-02-17 23:59:38 +01:00
|
|
|
#include <stdbool.h>
|
2024-02-15 19:42:22 +01:00
|
|
|
|
|
|
|
typedef enum {
|
2024-02-17 00:40:09 +01:00
|
|
|
SUCCESS,
|
2024-02-17 23:59:38 +01:00
|
|
|
FAILURE
|
|
|
|
} Status;
|
2024-02-17 00:40:09 +01:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
LOG_LEVEL_DEBUG,
|
2024-02-17 23:59:38 +01:00
|
|
|
LOG_LEVEL_INFO,
|
2024-02-17 00:40:09 +01:00
|
|
|
LOG_LEVEL_WARNING,
|
|
|
|
LOG_LEVEL_ERROR,
|
2024-02-15 19:42:22 +01:00
|
|
|
} LogLevel;
|
|
|
|
|
2024-02-17 00:40:09 +01:00
|
|
|
extern LogLevel log_level;
|
2024-02-15 19:42:22 +01:00
|
|
|
|
2024-02-17 23:59:38 +01:00
|
|
|
void SetLogLevel(LogLevel level);
|
|
|
|
void Log(LogLevel level, const char* format, ...);
|
2024-02-17 12:55:21 +01:00
|
|
|
|
2024-02-17 23:59:38 +01:00
|
|
|
Status Format(char** _string, const char* fmt, ...);
|
2024-02-17 14:21:14 +01:00
|
|
|
|
2024-02-17 23:59:38 +01:00
|
|
|
Status RunExecutable(int* _exit_code, char** _stdout, char** _stderr, const char* executable, ...);
|
2024-02-17 14:38:52 +01:00
|
|
|
|
2024-02-17 23:59:38 +01:00
|
|
|
Status ReadFileDescriptor(int fd, char** _content);
|
|
|
|
Status WriteFileDescriptor(int fd, const char* content);
|
|
|
|
Status ReadFile(const char* path, char** _content);
|
|
|
|
Status WriteFile(const char* path, const char* content);
|