gochatai/pachi_py/pachi/distributed/protocol.c
/* Write the time, client address, prefix, and string s to stderr atomically.
 * s should end with a \n */
Write the time, client address, prefix, and string s to stderr atomically.
s should end with a \n
Write the time client address prefix and string s to stderr atomically . s should end with a \ n
void
logline(struct in_addr *client, char *prefix, char *s)
{
	double now = time_now();
	char addr[INET_ADDRSTRLEN];
	if (client) {
#ifdef _WIN32
		strcpy(addr, inet_ntoa(*client));
#else
		inet_ntop(AF_INET, client, addr, sizeof(addr));
#endif
	} else {
		addr[0] = '\0';
	}
	pthread_mutex_lock(&log_lock);
	fprintf(stderr, "%s%15s %9.3f: %s", prefix, addr, now - start_time, s);
	pthread_mutex_unlock(&log_lock);
}
void logline ( struct in_addr * client , char * prefix , char * s ) { double now = time_now ( ) ; char addr [ INET_ADDRSTRLEN ] ; if ( client ) { #ifdef _WIN32 strcpy ( addr , inet_ntoa ( * client ) ) ; #else inet_ntop ( AF_INET , client , addr , sizeof ( addr ) ) ; #endif } else { addr [ 0 ] = ' \0 ' ; } pthread_mutex_lock ( & log_lock ) ; fprintf ( stderr , " " , prefix , addr , now - start_time , s ) ; pthread_mutex_unlock ( & log_lock ) ; }
Write the time, client address, prefix, and string s to stderr atomically.
Write the time client address prefix and string s to stderr atomically .