C Log Library

By | 2022년 2월 5일
Table of Contents

C Log Library

매우 간단한 라이브러리이고, 사용법도 https://github.com/rxi/log.c 만 참조하면 된다.

MIT 라이센스라 편하게 쓸 수 있다.

git clone https://github.com/rxi/log.c.git
cd log.c/src/
vi main.c
-------------------------
#include "log.h"

int main() {
    log_info("initializing...");
    log_debug("program terminated.");
}
-------------------------
gcc main.c log.c
./a.out
16:52:32 INFO  main.c:5: initializing...
16:52:32 DEBUG main.c:6: program terminated.

log_set_level 를 이용해 로그 레벨을 지정해 줄 수 있다.

log_add_fp 를 이용해 로그파일을 지정해 주면 로그에 날짜가 포함된다.

답글 남기기