本文整理汇总了C++中send_log函数的典型用法代码示例。如果您正苦于以下问题:C++ send_log函数的具体用法?C++ send_log怎么用?C++ send_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CREATE
/*
* Funzione fopen creata appositamente per gestire meglio la tipologia di file del BARD: MUD_FILE
*
* bool msg indica se visualizzare o meno il messaggio di errore apertura file
* gli sì dà un valore FALSE per i file aperti molto spesso oppure che non è
* obbligatorio che esistano
*/
MUD_FILE *mud_fopen( const char *dirname, const char *filename, const char *modes, bool msg )
{
MUD_FILE *fp;
char buf[MIL];
CREATE( fp, MUD_FILE, 1 );
/* Ha bisogno di filename non nullo perché lo utilizza per stamparlo nel messaggio di bug
* in caso di fallimento apertura mud_fopen */
if ( !VALID_STR(filename) )
{
send_log( NULL, LOG_BUG, "mud_fopen: filename passato non valido. dirname: %s modes:%s",
(dirname) ? dirname : "?",
(modes) ? modes : "?" );
filename = "?";
}
sprintf( buf, "%s%s", dirname, filename );
fp->path = str_dup( buf );
fp->file = fopen( fp->path, modes );
if ( !fp->file )
{
if ( msg )
{
send_log( NULL, LOG_FP, "mud_fopen: errore nell'apertura del file %s in modalità %s", fp->path, modes );
send_log( NULL, LOG_FP, "mud_fopen: strerror: %s", strerror(errno) );
}
MUD_FCLOSE( fp );
return NULL;
}
return fp;
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:42,代码来源:fread.c
示例2: pause_proxy
/* Temporarily disables listening on all of the proxy's listeners. Upon
* success, the proxy enters the PR_PAUSED state. If disabling at least one
* listener returns an error, then the proxy state is set to PR_STERROR
* because we don't know how to resume from this. The function returns 0
* if it fails, or non-zero on success.
*/
int pause_proxy(struct proxy *p)
{
struct listener *l;
if (!(p->cap & PR_CAP_FE) || p->state == PR_STERROR ||
p->state == PR_STSTOPPED || p->state == PR_STPAUSED)
return 1;
Warning("Pausing %s %s.\n", proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Pausing %s %s.\n", proxy_cap_str(p->cap), p->id);
for (l = p->listen; l != NULL; l = l->next) {
if (!pause_listener(l))
p->state = PR_STERROR;
}
if (p->state == PR_STERROR) {
Warning("%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id);
return 0;
}
p->state = PR_STPAUSED;
return 1;
}
开发者ID:BeachheadStudio,项目名称:haproxy,代码行数:31,代码来源:proxy.c
示例3: pause_proxies
/*
* This function temporarily disables listening so that another new instance
* can start listening. It is designed to be called upon reception of a
* SIGTTOU, after which either a SIGUSR1 can be sent to completely stop
* the proxy, or a SIGTTIN can be sent to listen again.
*/
void pause_proxies(void)
{
int err;
struct proxy *p;
err = 0;
p = proxy;
tv_update_date(0,1); /* else, the old time before select will be used */
while (p) {
if (p->cap & PR_CAP_FE &&
p->state != PR_STERROR &&
p->state != PR_STSTOPPED &&
p->state != PR_STPAUSED) {
Warning("Pausing %s %s.\n", proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Pausing %s %s.\n", proxy_cap_str(p->cap), p->id);
pause_proxy(p);
if (p->state != PR_STPAUSED) {
err |= 1;
Warning("%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id);
}
}
p = p->next;
}
if (err) {
Warning("Some proxies refused to pause, performing soft stop now.\n");
send_log(p, LOG_WARNING, "Some proxies refused to pause, performing soft stop now.\n");
soft_stop();
}
}
开发者ID:carriercomm,项目名称:haproxy-1.3,代码行数:36,代码来源:proxy.c
示例4: fread_letter
/*
* Read a letter from a file.
*/
char fread_letter( MUD_FILE *fp )
{
char c;
if ( !fp || !fp->file )
{
send_log( NULL, LOG_FREAD, "fread_letter: la struttura di fp è NULL" );
if ( fBootDb )
exit( EXIT_FAILURE );
return '\0';
}
do
{
if ( feof(fp->file) )
{
send_log( fp, LOG_FREAD, "fread_letter: EOF incontrato nella lettura." );
if ( fBootDb )
exit( EXIT_FAILURE );
return '\0';
}
c = getc( fp->file );
} while ( isspace(c) );
return c;
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:29,代码来源:fread.c
示例5: find_piece
/*
* Cerca nella scacchiera il pezzo passato impostando le coordinate passate
* Ritorna TRUE se lo ha trovato, altrimenti FALSE
*/
bool find_piece( CHESSBOARD_DATA *board, int *x, int *y, int piece )
{
int a;
int b;
if ( !board )
{
send_log( NULL, LOG_BUG, "find_piece: board passata è NULL" );
return FALSE;
}
if ( piece < 0 || piece >= PIECE_NONE )
{
send_log( NULL, LOG_BUG, "find_piece: piece passato è errato: %d", piece );
return FALSE;
}
for ( a = 0; a < 8; a++ )
{
for ( b = 0; b < 8; b++ )
{
if ( board->piece[a][b] == piece )
break;
}
}
*x = a;
*y = b;
if ( board->piece[a][b] == piece )
return TRUE;
return FALSE;
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:38,代码来源:game_chess.c
示例6: fread_to_eol
/*
* Legge fino a fine riga
* Viene più utilizzata per leggere i commenti che per ritornare valori
*/
void fread_to_eol( MUD_FILE *fp )
{
char c;
if ( !fp || !fp->file )
{
send_log( NULL, LOG_FREAD, "fread_to_eol: la struttura di fp è NULL" );
if ( fBootDb )
exit( EXIT_FAILURE );
return;
}
do
{
if ( feof(fp->file) )
{
send_log( fp, LOG_FREAD, "fread_to_eol: EOF incontrato nella lettura." );
if ( fBootDb )
exit( EXIT_FAILURE );
return;
}
c = getc( fp->file );
} while ( c != '\r' && c != '\n' );
do
{
c = getc( fp->file );
} while ( c == '\r' || c == '\n' );
ungetc( c, fp->file );
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:35,代码来源:fread.c
示例7: listen_proxies
/*
* This function reactivates listening. This can be used after a call to
* sig_pause(), for example when a new instance has failed starting up.
* It is designed to be called upon reception of a SIGTTIN.
*/
void listen_proxies(void)
{
struct proxy *p;
struct listener *l;
p = proxy;
tv_update_date(0,1); /* else, the old time before select will be used */
while (p) {
if (p->state == PR_STPAUSED) {
Warning("Enabling %s %s.\n", proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Enabling %s %s.\n", proxy_cap_str(p->cap), p->id);
for (l = p->listen; l != NULL; l = l->next) {
if (listen(l->fd, p->backlog ? p->backlog : p->maxconn) == 0) {
if (actconn < global.maxconn && p->feconn < p->maxconn) {
EV_FD_SET(l->fd, DIR_RD);
p->state = PR_STRUN;
}
else
p->state = PR_STIDLE;
} else {
int port;
if (l->addr.ss_family == AF_INET6) {
port = ntohs(((struct sockaddr_in6 *)(&l->addr))->sin6_port);
Warning("Port %d busy while trying to enable %s %s.\n",
port, proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Port %d busy while trying to enable %s %s.\n",
port, proxy_cap_str(p->cap), p->id);
}
else if (l->addr.ss_family == AF_INET) {
port = ntohs(((struct sockaddr_in *)(&l->addr))->sin_port);
Warning("Port %d busy while trying to enable %s %s.\n",
port, proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Port %d busy while trying to enable %s %s.\n",
port, proxy_cap_str(p->cap), p->id);
}
else {
Warning("Bind on socket %d busy while trying to enable %s %s.\n",
l->luid, proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Bind on socket %d busy while trying to enable %s %s.\n",
l->luid, proxy_cap_str(p->cap), p->id);
}
/* Another port might have been enabled. Let's stop everything. */
pause_proxy(p);
break;
}
}
}
p = p->next;
}
}
开发者ID:ChrisMacNaughton,项目名称:haproxy,代码行数:58,代码来源:proxy.c
示例8: session_kill_embryonic
/* This function kills an existing embryonic session. It stops the connection's
* transport layer, releases assigned resources, resumes the listener if it was
* disabled and finally kills the file descriptor. This function requires that
* sess->origin points to the incoming connection.
*/
static void session_kill_embryonic(struct session *sess)
{
int level = LOG_INFO;
struct connection *conn = __objt_conn(sess->origin);
struct task *task = sess->task;
unsigned int log = sess->fe->to_log;
const char *err_msg;
if (sess->fe->options2 & PR_O2_LOGERRORS)
level = LOG_ERR;
if (log && (sess->fe->options & PR_O_NULLNOLOG)) {
/* with "option dontlognull", we don't log connections with no transfer */
if (!conn->err_code ||
conn->err_code == CO_ER_PRX_EMPTY || conn->err_code == CO_ER_PRX_ABORT ||
conn->err_code == CO_ER_CIP_EMPTY || conn->err_code == CO_ER_CIP_ABORT ||
conn->err_code == CO_ER_SSL_EMPTY || conn->err_code == CO_ER_SSL_ABORT)
log = 0;
}
if (log) {
if (!conn->err_code && (task->state & TASK_WOKEN_TIMER)) {
if (conn->flags & CO_FL_ACCEPT_PROXY)
conn->err_code = CO_ER_PRX_TIMEOUT;
else if (conn->flags & CO_FL_ACCEPT_CIP)
conn->err_code = CO_ER_CIP_TIMEOUT;
else if (conn->flags & CO_FL_SSL_WAIT_HS)
conn->err_code = CO_ER_SSL_TIMEOUT;
}
session_prepare_log_prefix(sess);
err_msg = conn_err_code_str(conn);
if (err_msg)
send_log(sess->fe, level, "%s: %s\n", trash.str, err_msg);
else
send_log(sess->fe, level, "%s: unknown connection error (code=%d flags=%08x)\n",
trash.str, conn->err_code, conn->flags);
}
/* kill the connection now */
conn_stop_tracking(conn);
conn_full_close(conn);
conn_free(conn);
task_delete(task);
task_free(task);
session_free(sess);
}
开发者ID:spinpunch,项目名称:haproxy-1.8,代码行数:53,代码来源:session.c
示例9: soft_stop
/*
* this function disables health-check servers so that the process will quickly be ignored
* by load balancers. Note that if a proxy was already in the PAUSED state, then its grace
* time will not be used since it would already not listen anymore to the socket.
*/
void soft_stop(void)
{
struct proxy *p;
struct peers *prs;
stopping = 1;
p = proxy;
tv_update_date(0,1); /* else, the old time before select will be used */
while (p) {
if (p->state != PR_STSTOPPED) {
Warning("Stopping %s %s in %d ms.\n", proxy_cap_str(p->cap), p->id, p->grace);
send_log(p, LOG_WARNING, "Stopping %s %s in %d ms.\n", proxy_cap_str(p->cap), p->id, p->grace);
p->stop_time = tick_add(now_ms, p->grace);
}
if (p->table.size && p->table.sync_task)
task_wakeup(p->table.sync_task, TASK_WOKEN_MSG);
/* wake every proxy task up so that they can handle the stopping */
task_wakeup(p->task, TASK_WOKEN_MSG);
p = p->next;
}
prs = peers;
while (prs) {
stop_proxy((struct proxy *)prs->peers_fe);
prs = prs->next;
}
/* signal zero is used to broadcast the "stopping" event */
signal_handler(0);
}
开发者ID:BeachheadStudio,项目名称:haproxy,代码行数:35,代码来源:proxy.c
示例10: fork_call
void fork_call(void *(*procedure)(void *), char *info)
{
pthread_t proc;
t_call call;
void *to_pass;
int ret;
call=procedure;
to_pass=*(void **)(&call); /* HAHAHA ! Try to know why I did that ! :-) */
if (IS_VERBOSE)
send_log(LOG_INFO, "Scheduler create thread %d to [%s]\n", ++gl_nbr_thread, info);
ret=pthread_create(&proc, NULL, thread_and_exit, to_pass);
pthread_detach(proc);
if (ret != ZERO)
send_log(LOG_EMERG, "[28] Can't create Thread for scheduling\n");
}
开发者ID:GaetanJUVIN,项目名称:mooner,代码行数:16,代码来源:scheduler.c
示例11: free_chessboard
/*
* Libera la struttura di una scacchiera
*/
void free_chessboard( CHESSBOARD_DATA *board )
{
char buf[MSL];
if ( !board )
{
send_log( NULL, LOG_BUG, "free_board: board passata è NULL" );
return;
}
sprintf( buf, "Il gioco è terminato dopo %d mosse.\r\n", board->moves );
if ( board->player1 )
send_to_char( board->player1, buf );
if ( board->player2 )
send_to_char( board->player2, buf );
UNLINK( board, first_chessboard, last_chessboard, next, prev );
top_chessboard--;
board->player1 = NULL;
board->player2 = NULL;
board->turn = NULL;
destroybv( board->flags1 );
destroybv( board->flags2 );
DISPOSE( board );
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:31,代码来源:game_chess.c
示例12: resume_proxies
/*
* This function reactivates listening. This can be used after a call to
* sig_pause(), for example when a new instance has failed starting up.
* It is designed to be called upon reception of a SIGTTIN.
*/
void resume_proxies(void)
{
int err;
struct proxy *p;
struct peers *prs;
err = 0;
p = proxy;
tv_update_date(0,1); /* else, the old time before select will be used */
while (p) {
err |= !resume_proxy(p);
p = p->next;
}
prs = peers;
while (prs) {
p = prs->peers_fe;
err |= !resume_proxy(p);
prs = prs->next;
}
if (err) {
Warning("Some proxies refused to resume, a restart is probably needed to resume safe operations.\n");
send_log(p, LOG_WARNING, "Some proxies refused to resume, a restart is probably needed to resume safe operations.\n");
}
}
开发者ID:BeachheadStudio,项目名称:haproxy,代码行数:31,代码来源:proxy.c
示例13: pause_proxies
/*
* This function temporarily disables listening so that another new instance
* can start listening. It is designed to be called upon reception of a
* SIGTTOU, after which either a SIGUSR1 can be sent to completely stop
* the proxy, or a SIGTTIN can be sent to listen again.
*/
void pause_proxies(void)
{
int err;
struct proxy *p;
struct peers *prs;
err = 0;
p = proxy;
tv_update_date(0,1); /* else, the old time before select will be used */
while (p) {
err |= !pause_proxy(p);
p = p->next;
}
prs = peers;
while (prs) {
p = prs->peers_fe;
err |= !pause_proxy(p);
prs = prs->next;
}
if (err) {
Warning("Some proxies refused to pause, performing soft stop now.\n");
send_log(p, LOG_WARNING, "Some proxies refused to pause, performing soft stop now.\n");
soft_stop();
}
}
开发者ID:BeachheadStudio,项目名称:haproxy,代码行数:33,代码来源:proxy.c
示例14: send_headers
// format of sending header
void send_headers(FILE *f, char *path, int status, char *title, char *extra, char *mime, int length, time_t date) {
time_t now;
char timebuf[128];
send_log(path, status, title, extra, mime, length, date);
fprintf(f, "%s %d %s\r\n", PROTOCOL, status, title);
fprintf(f, "Server: %s\r\n", SERVER);
now = time(NULL);
strftime(timebuf, sizeof(timebuf), RFC1123FMT, gmtime(&now));
fprintf(f, "Date: %s\r\n", timebuf);
if (extra)
fprintf(f, "%s\r\n", extra);
if (mime)
fprintf(f, "Content-Type: %s\r\n", mime);
if (length >= 0)
fprintf(f, "Content-Length: %d\r\n", length);
if (date != -1) {
strftime(timebuf, sizeof(timebuf), RFC1123FMT, gmtime(&date));
fprintf(f, "Last-Modified: %s\r\n", timebuf);
}
fprintf(f, "Connection: close\r\n");
fprintf(f, "\r\n");
/////////////// send_log
// send_log(path, status, title, extra, mime, length, date);
//////////////
}
开发者ID:yeanlingyawner,项目名称:webServer,代码行数:31,代码来源:teamServerCGITested2.c
示例15: spec_executioner
SPEC_RET spec_executioner( CHAR_DATA *ch )
{
MOB_PROTO_DATA *cityguard;
CHAR_DATA *victim;
CHAR_DATA *v_next;
char *crime;
char buf[MSL];
if ( !is_awake(ch) ) return FALSE;
if ( ch->fighting ) return FALSE;
crime = "";
for ( victim = ch->in_room->first_person; victim; victim = v_next )
{
v_next = victim->next_in_room;
if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_KILLER) )
{
crime = "assassino";
break;
}
if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_THIEF) )
{
crime = "ladro";
break;
}
}
if ( !victim )
return FALSE;
if ( HAS_BIT(ch->in_room->flags, ROOM_SAFE) )
{
sprintf( buf, "yell codardo di un %s!", crime ); /* (GR) articolo */
send_command( ch, buf, CO );
return TRUE;
}
sprintf( buf, "yell Proteggiamo l'innocente dal %s!!", crime ); /* (GR) articolo dal dall' */
send_command( ch, buf, CO );
multi_hit( ch, victim, TYPE_UNDEFINED );
if ( char_died(ch) )
return TRUE;
/* Aggiunto il log nel caso che venga a mancare la guardia cittadina */
cityguard = get_mob_index( NULL, VNUM_MOB_CITYGUARD );
if ( !cityguard )
{
send_log( NULL, LOG_BUG, "spec_executioner: Guardia cittadina mancante - Vnum:[%d]", VNUM_MOB_CITYGUARD );
return TRUE;
}
char_to_room( make_mobile(cityguard), ch->in_room );
char_to_room( make_mobile(cityguard), ch->in_room );
return TRUE;
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:59,代码来源:special.c
示例16: set_backend_down
/* sends a log message when a backend goes down, and also sets last
* change date.
*/
void set_backend_down(struct proxy *be)
{
be->last_change = now.tv_sec;
be->down_trans++;
Alert("%s '%s' has no server available!\n", proxy_type_str(be), be->id);
send_log(be, LOG_EMERG, "%s %s has no server available!\n", proxy_type_str(be), be->id);
}
开发者ID:Chilledheart,项目名称:haproxy,代码行数:11,代码来源:backend.c
示例17: send_log
char *print_bool( const bool value )
{
if ( value == TRUE )
return "True";
else
return "False";
send_log( NULL, LOG_FWRITE, "print_bool: valore non booleano: %d.", value );
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:9,代码来源:fread.c
示例18: log
void log( const plugin::log_msg_t type, const char* tag, const char* format, va_list vars ){
static char msg_buffer[ 1024 ];
if( g_logger ){
memset( msg_buffer, 0, 1024 );
vsprintf_s( msg_buffer, format, vars );
send_log( type, tag, msg_buffer );
};
};
开发者ID:FrankStain,项目名称:tex-conv,代码行数:9,代码来源:descriptor.cpp
示例19: remote_playloop
int remote_playloop(void) {
Status s;
/* Check the status. If the player should pause,
then signal that the command has been processed
and wait for a new status. A new status will end
the player and return control to the main loop.
The main loop will signal that the new command
has been processed.
*/
pthread_mutex_lock (&main_lock);
s = getstatus();
pthread_mutex_unlock (&main_lock);
send_log("playloop entry s=%d", s);
if (s == PAUSE) {
/* Send "pause on" */
send_msg("P 1");
while (s == PAUSE) {
sem_post(&sem_processed);
sem_wait(&sem_command);
pthread_mutex_lock (&main_lock);
s = getstatus();
pthread_mutex_unlock (&main_lock);
}
/* Send "pause off" */
send_msg("P 2");
}
/* Send stop msg to the frontend */
/* this probably should be done after the audio buffer is flushed and no audio is actually playing, but don't know how */
if ((s == STOP) || (s == QUIT)) send_msg("P 0");
send_log("playloop exit s=%d", s);
return ((s == NEXT) || (s == STOP) || (s == QUIT));
}
开发者ID:imalone,项目名称:imalone_vorbis-tools,代码行数:44,代码来源:remote.c
示例20: fread_list
/*
* Funzione di lettura delle liste, cioè dei file *.lst.
*/
void fread_list( const char *list_file, const char *section, FREAD_FUN *freadfun, bool unique )
{
MUD_FILE *fp;
fp = mud_fopen( "", list_file, "r", TRUE );
if ( !fp )
{
if ( fBootDb )
exit( EXIT_FAILURE );
return;
}
for ( ; ; )
{
char *filename;
if ( feof(fp->file) )
{
send_log( fp, LOG_FREAD, "fread_: fine del file prematuro nella lettura" );
if ( fBootDb )
exit( EXIT_FAILURE );
}
filename = fread_word( fp );
if ( filename[0] == '*' ) /* Salta i commenti */
{
fread_to_eol( fp );
continue;
}
/* Se arrivato alla fine esce */
if ( !str_cmp(filename, "End") )
break;
/* Legge l'area se si tratta di una sezione file di area */
if ( !str_cmp(section, "AREA_FILE") && freadfun == NULL )
{
MUD_FILE *fp_area;
fp_area = mud_fopen( "", filename, "r", TRUE );
if ( !fp_area )
{
if ( fBootDb )
exit( EXIT_FAILURE );
return;
}
load_area_file( NULL, fp_area );
}
else
fread_section( filename, section, freadfun, unique ); /* Legge la sezione relativa al file ricavato dalla lista */
}
MUD_FCLOSE( fp );
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:59,代码来源:fread.c
注:本文中的send_log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论