0
저는 프로그래밍에 익숙하지 않고 lighttpd를 처음 사용하는 학생입니다. 간단한 "Hello world"플러그인이 어떻게 구성되는지 이해하려고합니다. 책에서 코드를 발견했습니다. 코드는 다음과 같습니다.혼란스러운 log_trace 함수
#includes "base.h"
#includes "log.h"
#includes "plugin.h"
#ifdef HAVE_CONFIG_H
#includes "config.h"
#endif
typedef struct { PLUGIN_DATA; /* no config */ } plugin_data;
INIT_FUNC(mod_helloworld_init) {
plugin_data *p;
UNUSED(srv);
p = calloc(1, sizeof(*p));
log_trace("Hello, World!");
return p;
}
FREE_FUNC(mod_helloworld_free) {
plugin_data *p = p_d;
UNUSED(srv);
if (p) free(p);
return HANDLER_GO_ON;
}
int mod_helloworld_plugin_init(plugin *p) {
p->version = LIGHTTPD_VERSION_ID;
p->name = buffer_init_string("helloworld");
p->init = mod_helloworld_init;
p->cleanup = mod_helloworld_free;
p->data = NULL;
return 0;
}
위에서 언급 한 코드에서 "log_trace"기능이 어떻게 작동하는지 이해할 수 없습니다. C++에서는 미리 정의 된 함수가 아닙니다. 프로그래머가 직접 작성해야하는 것처럼 보입니다. 어떻게 작동하는지 설명해 주시겠습니까?
그 헤더 파일 _LOG_H_ #DEFINE _LOG_H_ 사용법 #include "server.h"#ifndef 다음 포함 /* 닫기 FD 대신 그것을 위해을/dev/null를 얻을 수 _try_. * 성공시 0을 반환하고 실패시 -1을 반환합니다 (모든 경우에 fd가 닫힘) */ int openDevNull (int fd); #define WP() log_error_write (srv, __FILE__, __LINE__, ""); int open_logfile_or_pipe (서버 * srv, const char * logfile); int log_error_open (server * srv); int log_error_close (server * srv); int log_error_write (서버 * srv, const char * 파일 이름, 부호없는 int 줄, const char * fmt, ...); int log_error_cycle (server * srv); #endif –
log_trace에 관한 내용은 볼 수 없습니다. –