-#ifndef __NT__
- bLogToSock = 0;
-#else
- // init winsock
- // check and prepare WinSock DLL
- WORD wVersionRequested = MAKEWORD( 2, 2 );
- WSADATA wsaData;
- if ( WSAStartup(wVersionRequested, &wsaData) != 0 )
- {
- bLogToSock = false;
- return;
- }
- // Confirm that the WinSock DLL supports 2.2.
- // Note that if the DLL supports versions greater
- // than 2.2 in addition to 2.2, it will still return
- // 2.2 in wVersion since that is the version we
- // requested.
-
- if ( LOBYTE( wsaData.wVersion ) != 2 || HIBYTE( wsaData.wVersion ) != 2 )
- {
- bLogToSock = false;
- return;
- }
-
- struct hostent *hp;
- hp = gethostbyname(servAddr);
- if (hp == NULL) // we don't know who this host is
- {
- bLogToSock = false;
- return;
- }
-
- // connect socket
- sockaddr_in SocketAddress;
-
- memset(&SocketAddress, 0, sizeof(SocketAddress));
- memcpy((char*)&SocketAddress.sin_addr, hp->h_addr, hp->h_length); // set address
- SocketAddress.sin_family = hp->h_addrtype;
- SocketAddress.sin_port = htons((u_short)atoi(logPort));
-
- logSocket = socket(hp->h_addrtype, SOCK_STREAM, 0);
- if (logSocket == INVALID_SOCKET)
- {
- bLogToSock = false;
- return;
- }
-
- // try to connect to the specified socket
- if ( connect(logSocket, (struct sockaddr*)&SocketAddress, sizeof (SocketAddress)) == SOCKET_ERROR) {
- bLogToSock = false;
- return;
- }
- bLogToSock = true;
-#endif
+ if(level>maxloglevel)
+ maxloglevel=level;
+ screenloglevel = level;
+}
+void setFileLogging(char*filename, int level, char append)
+{
+ if(level>maxloglevel)
+ maxloglevel=level;
+ if(logFile) {
+ fclose(logFile);logFile=0;
+ }
+ if(filename && level>=0) {
+ logFile = fopen(filename, append?"ab+":"wb");
+ fileloglevel = level;
+ } else {
+ logFile = 0;
+ fileloglevel = 0;
+ }
+}
+/* deprecated */
+void initLog(char* filename, int fileloglevel, char* s00, char* s01, int s02, int screenlevel)
+{
+ setFileLogging(filename, fileloglevel, 0);
+ setConsoleLogging(screenloglevel);