sotn-decomp/include/log.h
Luciano Ciccariello 151346d62c
Update clang-format as self-contained binary (#1257)
Version 18.1.6 pulled from
https://github.com/xeeynamo/sotn-decomp/releases and compiled with the
following:

```Dockerfile
FROM alpine:latest
RUN apk add --no-cache \
    build-base \
    cmake \
    git \
    ninja \
    libstdc++ \
    zlib-dev \
    python3
ENV LLVM_VERSION=llvmorg-18.1.6
RUN mkdir -p /opt/llvm \
    && cd /opt/llvm \
    && git clone --depth=1 --branch $LLVM_VERSION https://github.com/llvm/llvm-project.git \
    && mkdir -p llvm-project/build \
    && cd llvm-project/build \
    && cmake -G Ninja \
        -DLLVM_ENABLE_PROJECTS=clang \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_CXX_FLAGS="-static-libstdc++ -static-libgcc" \
        -DCMAKE_EXE_LINKER_FLAGS="-static" \
        -DLLVM_ENABLE_RTTI=ON \
        ../llvm \
    && ninja clang-format \
    && strip bin/clang-format
FROM scratch
COPY --from=0 /opt/llvm/llvm-project/build/bin/clang-format /clang-format
ENTRYPOINT ["/usr/local/bin/clang-format"]
```
`docker build --output . .`

Original source code:
https://github.com/llvm/llvm-project/tree/llvmorg-18.1.6
commit: `1118c2e05e67a36ed8ca250524525cdb66a55256`
2024-06-04 21:07:50 +01:00

37 lines
840 B
C

#ifndef LOG_H
#define LOG_H
#include "common.h"
typedef enum {
LOG_LEVEL_D,
LOG_LEVEL_I,
LOG_LEVEL_W,
LOG_LEVEL_E,
} LOG_LEVEL;
#define NAMEOF(var) #var
#define NOT_IMPLEMENTED WARNF("not implemented")
#ifndef NO_LOGS
#define DEBUGF(...) _log(LOG_LEVEL_D, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define INFOF(...) _log(LOG_LEVEL_I, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define WARNF(...) _log(LOG_LEVEL_W, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define ERRORF(...) _log(LOG_LEVEL_E, __FILE__, __LINE__, __func__, __VA_ARGS__)
void SetMinLogLevel(LOG_LEVEL level);
void _log(unsigned int level, const char* file, unsigned int line,
const char* func, const char* fmt, ...);
#else
#define DEBUGF(fmt, ...)
#define INFOF(fmt, ...)
#define WARNF(fmt, ...)
#define ERRORF(fmt, ...)
#endif
#endif