MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / xlog_new_context

Function xlog_new_context

common/log/xlog.c:144–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144static xlog_context* xlog_new_context(int bConsole)
145{
146 int i=0;
147 xlog_context *ctx = (xlog_context*)malloc(sizeof(xlog_context));
148
149 if (ctx != NULL){
150 for(i=0; i< RECEIVER_MAX_COUNT; i++){
151 ctx->_receivers[i]._fn = NULL;
152 ctx->_receivers[i]._file = NULL;
153 ctx->_receivers[i]._enable = 0;
154 ctx->_receivers[i]._rev = NULL;
155 ctx->_receivers[i]._type = -1;
156 }
157 ctx->_count = 0;
158 ctx->_log_level = XLOG_LEVEL_INFO;
159
160 if (bConsole){
161 ctx->_receivers[0]._fn = print_to_console;
162 ctx->_receivers[0]._type = RECEIVER_TYPE_CONSOLE;
163 ctx->_receivers[0]._enable = 1;
164 ctx->_count = 1;
165 }
166
167 pthread_mutex_init(&ctx->_mutext, NULL);
168 }
169
170 return ctx;
171}
172
173/**
174 * create a log context, the console is default log receiver

Callers 2

xlog_newFunction · 0.85
xlog_new2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected