1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| struct msgin_log * pin;
struct msgout_log * pout;
char * c;
char Buffer[2048];
char fname[255];
time_t ti;
struct tm * tm = NULL;
FILE * fp = NULL;
pin = (struct msgin_log *)msg->data_in;
pout = (struct msgout_log *)msg->data_out;
msg->len_out = sizeof (struct msgout_log);
memset (pout, 0, sizeof (struct msgout_log));
// reconstitution du nom du fichier de log support_sofi.client.yyyy-mm-dd.log
time (&ti);
tm = localtime (&ti);
strncpy ( Buffer, pin->InMsg, 2048 );
sprintf ( fname, "support_sofi.client.%04d-%02d-%02d.log", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday );
fp = fopen (fname, "a");
if ( fp != NULL )
{
//fprintf ( fp,"%s", Buffer );
//fwrite (Buffer , 1 , sizeof(Buffer) , fp );
fputs(Buffer,fp);
fclose (fp);
fp = NULL;
}
//strcpy ( pout->OutMsg, "" );
trace ("_log end");
} |
Partager