本文整理汇总了C++中Log::Print方法的典型用法代码示例。如果您正苦于以下问题:C++ Log::Print方法的具体用法?C++ Log::Print怎么用?C++ Log::Print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::Print方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
#endif
{
if (strncmp(szCmdLine, "-launch ", 8) == 0) {
HWND hwnd;
ULONG id;
sscanf(&szCmdLine[8], "%lx:%lx", &hwnd, &id);
MetaLauncher::launch(hwnd, id);
return 0;
}
if (strcmp(szCmdLine, "-cleanmenu") == 0) {
MetaLauncher::cleanAllMenus();
return 0;
}
// The state of the application as a whole is contained in the one app object
#ifdef _WIN32_WCE
VNCviewerApp app(hInstance, szCmdLine);
#else
VNCviewerApp32 app(hInstance, szCmdLine);
#endif
// Start a new connection if specified on command line,
// or if not in listening mode
if (app.m_options.m_connectionSpecified) {
app.NewConnection(app.m_options.m_host, app.m_options.m_port);
} else if (!app.m_options.m_listening) {
// This one will also read from config file if specified
app.NewConnection();
}
MSG msg;
std::list<HWND>::iterator iter;
try {
while (GetMessage(&msg, NULL, 0, 0)) {
if ( !hotkeys.TranslateAccel(&msg) &&
!help.TranslateMsg(&msg) &&
!app.ProcessDialogMessage(&msg) ) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
} catch (WarningException &e) {
e.Report();
} catch (QuietException &e) {
e.Report();
}
// Clean up winsock
WSACleanup();
vnclog.Print(3, _T("Exiting\n"));
return msg.wParam;
}
示例2: read_reg_string
static BOOL read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) {
HKEY hkey;
BOOL ret = FALSE;
int retv;
if(ERROR_SUCCESS == RegOpenKeyEx(key,
sub_key,
0, KEY_QUERY_VALUE, &hkey)) {
if(ERROR_SUCCESS == (retv=RegQueryValueEx(hkey, val_name, 0, NULL, data, data_len)))
ret = TRUE;
else
vnclog.Print(3,"Could not read reg key '%s' subkey '%s' value: '%s'\nError: %u\n",
((key == HKEY_LOCAL_MACHINE) ? "HKLM" : (key == HKEY_CURRENT_USER) ? "HKCU" : "???"),
sub_key, val_name, (UINT)GetLastError());
RegCloseKey(key);
}
else
vnclog.Print(3,"Could not open reg subkey: %s\nError: %u\n", sub_key, (UINT)GetLastError());
return ret;
}
示例3: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
int retval = 0;
// The state of the application as a whole is contained in the one app object
VNCviewerApp32 app(hInstance, szCmdLine);
// Start a new connection if one if specified on the command line or if
// listening mode is not specified
if (app.m_options.m_connectionSpecified) {
retval = app.NewConnection(app.m_options.m_host, app.m_options.m_port);
} else if (!app.m_options.m_listening) {
// This one will also read from a config file, if specified
retval = app.NewConnection();
}
if (app.m_options.m_benchFile) {
fclose(app.m_options.m_benchFile);
return retval;
}
MSG msg;
std::list<HWND>::iterator iter;
try {
while (GetMessage(&msg, NULL, 0, 0)) {
if (!hotkeys.TranslateAccel(&msg) && !help.TranslateMsg(&msg) &&
!app.ProcessDialogMessage(&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if (msg.message == WM_CLOSE) retval = (int)msg.wParam;
}
} catch (WarningException &e) {
e.Report();
retval = 1;
} catch (QuietException &e) {
e.Report();
retval = 1;
}
// Clean up winsock
WSACleanup();
vnclog.Print(3, "Exiting\n");
return retval;
}
示例4: NotifyService
int __stdcall NotifyService()
{
int nRet = 0;
log.Print(LL_DEBUG_INFO,"Enter NotifyService\r\n");
HANDLE hevent = OpenEventW(EVENT_ALL_ACCESS,false,EventName);
if ((hevent == NULL) || (hevent == INVALID_HANDLE_VALUE) )
{
log.Print(LL_DEBUG_INFO,"OpenEventW Global\\FS_Index_Notify !GetLastError=%d\r\n",GetLastError());
hevent = CreateEventW(NULL,true,false,EventName);
}
if (!SetEvent(hevent))
{
log.Print(LL_DEBUG_INFO,"SetEvent Failed!GetLastError=%d \r\n",GetLastError());
nRet = -1;
}
CloseHandle(hevent);
log.Print(LL_DEBUG_INFO,"Leave NotifyService\r\n");
return nRet;
}
示例5: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
#endif
{
setbuf(stderr, 0);
bool console = false;
// The state of the application as a whole is contained in the one app object
#ifdef _WIN32_WCE
VNCviewerApp app(hInstance, szCmdLine);
#else
VNCviewerApp32 app(hInstance, szCmdLine);
#endif
console = app.m_options.m_logToConsole;
// Start a new connection if specified on command line,
// or if not in listening mode
if (app.m_options.m_connectionSpecified) {
app.NewConnection(app.m_options.m_host, app.m_options.m_port);
} else if (!app.m_options.m_listening) {
// This one will also read from config file if specified
app.NewConnection();
}
MSG msg;
try {
while ( GetMessage(&msg, NULL, 0,0) ) {
DispatchMessage(&msg);
}
} catch (WarningException &e) {
e.Report();
} catch (QuietException &e) {
e.Report();
}
// Clean up winsock
WSACleanup();
log.Print(3, _T("Exiting\n"));
if (console) Sleep(2000);
return msg.wParam;
}
示例6: WinMain
//.........这里部分代码省略.........
LoadString(m_hInstResDLL, IDS_L66, sz_L66, 64 -1);
LoadString(m_hInstResDLL, IDS_L67, sz_L67, 64 -1);
LoadString(m_hInstResDLL, IDS_L68, sz_L68, 64 -1);
LoadString(m_hInstResDLL, IDS_L69, sz_L69, 64 -1);
LoadString(m_hInstResDLL, IDS_L70, sz_L70, 64 -1);
LoadString(m_hInstResDLL, IDS_L71, sz_L71, 64 -1);
LoadString(m_hInstResDLL, IDS_L72, sz_L72, 64 -1);
LoadString(m_hInstResDLL, IDS_L73, sz_L73, 64 -1);
LoadString(m_hInstResDLL, IDS_L74, sz_L74, 64 -1);
LoadString(m_hInstResDLL, IDS_L75, sz_L75, 64 -1);
LoadString(m_hInstResDLL, IDS_L76, sz_L76, 64 -1);
LoadString(m_hInstResDLL, IDS_L77, sz_L77, 64 -1);
LoadString(m_hInstResDLL, IDS_L78, sz_L78, 64 -1);
LoadString(m_hInstResDLL, IDS_L79, sz_L79, 64 -1);
LoadString(m_hInstResDLL, IDS_L80, sz_L80, 64 -1);
LoadString(m_hInstResDLL, IDS_L81, sz_L81, 64 -1);
LoadString(m_hInstResDLL, IDS_L82, sz_L82, 64 -1);
LoadString(m_hInstResDLL, IDS_L83, sz_L83, 64 -1);
LoadString(m_hInstResDLL, IDS_L84, sz_L84, 64 -1);
LoadString(m_hInstResDLL, IDS_L85, sz_L85, 64 -1);
LoadString(m_hInstResDLL, IDS_L86, sz_L86, 64 -1);
LoadString(m_hInstResDLL, IDS_L87, sz_L87, 64 -1);
LoadString(m_hInstResDLL, IDS_L88, sz_L88, 64 -1);
LoadString(m_hInstResDLL, IDS_L89, sz_L89, 64 -1);
LoadString(m_hInstResDLL, IDS_L90, sz_L90, 64 -1);
LoadString(m_hInstResDLL, IDS_L91, sz_L91, 64 -1);
LoadString(m_hInstResDLL, IDS_L92, sz_L92, 64 -1);
LoadString(m_hInstResDLL, IDS_M1, sz_M1, 64 -1);
LoadString(m_hInstResDLL, IDS_M2, sz_M2, 64 -1);
LoadString(m_hInstResDLL, IDS_M3, sz_M3, 64 -1);
LoadString(m_hInstResDLL, IDS_M4, sz_M4, 64 -1);
LoadString(m_hInstResDLL, IDS_M5, sz_M5, 64 -1);
LoadString(m_hInstResDLL, IDS_M6, sz_M6, 64 -1);
LoadString(m_hInstResDLL, IDS_M7, sz_M7, 64 -1);
LoadString(m_hInstResDLL, IDS_M8, sz_M8, 64 -1);
// 14 April 2008 jdp
LoadString(m_hInstResDLL, IDS_H94, sz_H94, 64 -1);
LoadString(m_hInstResDLL, IDS_H95, sz_H95, 64 -1);
LoadString(m_hInstResDLL, IDS_H96, sz_H96, 64 -1);
LoadString(m_hInstResDLL, IDS_H97, sz_H97, 64 -1);
LoadString(m_hInstResDLL, IDS_H98, sz_H98, 64 -1);
LoadString(m_hInstResDLL, IDS_H99, sz_H99, 64 -1);
// RegisterLinkLabel(m_hInstResDLL);
/////////////////////////////////////////////////////////////
// The state of the application as a whole is contained in the one app object
#ifdef _WIN32_WCE
VNCviewerApp app(hInstance, szCmdLine);
#else
VNCviewerApp32 app(hInstance, szCmdLine);
#endif
console = app.m_options.m_logToConsole;
// Start a new connection if specified on command line,
// or if not in listening mode
MSG msg;
while(g_passwordfailed==true)
{
g_passwordfailed=false;
if (app.m_options.m_connectionSpecified && !app.m_options.m_listening) {
app.NewConnection(app.m_options.m_host_options, app.m_options.m_port);
} else if (!app.m_options.m_listening) {
// This one will also read from config file if specified
app.NewConnection();
}
try
{
while ( GetMessage(&msg, NULL, 0,0) )
{
if (!TheAccelKeys.TranslateAccelKeys(&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
catch (WarningException &e)
{
e.Report();
}
catch (QuietException &e)
{
e.Report();
}
}
// Clean up winsock
WSACleanup();
vnclog.Print(3, _T("Exiting\n"));
if (console) Sleep(2000);
return msg.wParam;
}
示例7: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
#endif
{
#ifdef IPP
InitIpp();
#endif
#ifdef CRASHRPT
Install(NULL, _T("[email protected]"), _T(""));
#endif
setbuf(stderr, 0);
bool console = false;
m_hInstResDLL = NULL;
// [v1.0.2-jp1 fix]
//m_hInstResDLL = LoadLibrary("lang.dll");
HMODULE hmod;
HKEY hkey;
if((hmod=GetModuleHandle("kernel32.dll")))
{
MySetDllDirectory = (LPFNSETDLLDIRECTORY)GetProcAddress(hmod, "SetDllDirectoryA");
if(MySetDllDirectory) MySetDllDirectory("");
else
{
OSVERSIONINFO osinfo;
osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osinfo);
if((osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion == 0 && strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) ||
(osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion == 1 && strcmp(osinfo.szCSDVersion, "") >= 0))
{
DWORD regval = 1;
DWORD reglen = sizeof(DWORD);
vnclog.Print(3,"Using Win2k (SP3+) / WinXP (No SP).. Checking SafeDllSearch\n");
read_reg_string(HKEY_LOCAL_MACHINE,
"System\\CurrentControlSet\\Control\\Session Manager",
"SafeDllSearchMode",
(LPBYTE)®val,
®len);
if(regval != 0) {
vnclog.Print(3,"Trying to set SafeDllSearchMode to 0\n");
regval = 0;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"System\\CurrentControlSet\\Control\\Session Manager",
0, KEY_SET_VALUE, &hkey) == ERROR_SUCCESS) {
if(RegSetValueEx(hkey,
"SafeDllSearchMode",
0,
REG_DWORD,
(LPBYTE) ®val,
sizeof(DWORD)) != ERROR_SUCCESS)
vnclog.Print(3,"Error writing SafeDllSearchMode. Error: %u\n",(UINT)GetLastError());
RegCloseKey(hkey);
}
else
vnclog.Print(3,"Error opening Session Manager key for writing. Error: %u\n",(UINT)GetLastError());
}
else
vnclog.Print(3,"SafeDllSearchMode is set to 0\n");
}
}
}
//limit the vnclang.dll searchpath to avoid
char szCurrentDir[MAX_PATH];
char szCurrentDir_vnclangdll[MAX_PATH];
if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
{
char* p = strrchr(szCurrentDir, '\\');
*p = '\0';
}
strcpy (szCurrentDir_vnclangdll,szCurrentDir);
strcat (szCurrentDir_vnclangdll,"\\");
strcat (szCurrentDir_vnclangdll,"vnclang.dll");
m_hInstResDLL = LoadLibrary(szCurrentDir_vnclangdll);
if (m_hInstResDLL==NULL)
{
m_hInstResDLL = hInstance;
}
if (strcmp(szCmdLine,"")==0) command_line=false;
LoadString(m_hInstResDLL, IDS_A1, sz_A1, 64 -1);
LoadString(m_hInstResDLL, IDS_A2, sz_A2, 64 -1);
LoadString(m_hInstResDLL, IDS_A3, sz_A3, 64 -1);
LoadString(m_hInstResDLL, IDS_A4, sz_A4, 64 -1);
LoadString(m_hInstResDLL, IDS_A5, sz_A5, 64 -1);
LoadString(m_hInstResDLL, IDS_B1, sz_B1, 64 -1);
LoadString(m_hInstResDLL, IDS_B2, sz_B2, 64 -1);
LoadString(m_hInstResDLL, IDS_B3, sz_B3, 64 -1);
LoadString(m_hInstResDLL, IDS_C1, sz_C1, 64 -1);
LoadString(m_hInstResDLL, IDS_C2, sz_C2, 64 -1);
LoadString(m_hInstResDLL, IDS_C3, sz_C3, 64 -1);
LoadString(m_hInstResDLL, IDS_D1, sz_D1, 64 -1);
//.........这里部分代码省略.........
示例8: main
int main(int argc, char *argv[])
{
int port = DEFAULT_SECTOR_SERVER_PORT;
int max_sectors = DEFAULT_MAX_SECTORS;
char *address = "127.0.0.1";
unsigned int ip_address;
unsigned int server_type = 0;
g_Log.Print("Net-7 is starting...");
if(argc == 1)
{
//sprintf(g_LogFile, "%sNet7_server.log", SERVER_LOGS_PATH);
server_type |= SERVER_TYPE_STANDALONE;
}
else
{
for (int i = 1; i < argc; i++)
{
if ((strncmp(argv[i], "/ADDRESS:", 9) == 0))
{
address = argv[i] + 9;
}
else if ((strcmp(argv[i], "/MASTER") == 0) && !(server_type & SERVER_TYPE_MASTER))
{
server_type |= SERVER_TYPE_MASTER;
//server_name = "Master Server";
//strcpy(mutex_name, MASTER_INSTANCE_MUTEX_NAME);
//sprintf(g_LogFile, "%sNet7_server.log", SERVER_LOGS_PATH);
//LogMessage("Net7 Master Server (Auth:%d, Global:%d, Master:%d)\n",
//SSL_PORT, GLOBAL_SERVER_PORT, MASTER_SERVER_PORT);
}
else if ((strncmp(argv[i], "/PORT:", 6) == 0) && !(server_type & SERVER_TYPE_SECTOR))
{
server_type |= SERVER_TYPE_SECTOR;
port = atoi(argv[i] + 6);
//sprintf(mutex_name, SECTOR_INSTANCE_MUTEX_NAME, port);
//server_name = "Sector Server";
//sprintf(g_LogFile, "%ssector_server_%d.log", SERVER_LOGS_PATH, port);
//LogMessage("Net7 Sector Server (Port %d)\n", port);
}
else if ((strncmp(argv[i], "/MAX_SECTORS:", 13) == 0) && (server_type & SERVER_TYPE_SECTOR))
{
max_sectors = atoi(argv[i] + 13);
}
else
{
printf("Net7 Usage:\n\n");
printf("to run the main server:\n");
printf(" Net7 /MASTER /ADDRESS:(ip address)\n\n");
printf("to run a sector server:\n");
printf(" Net7 /PORT:3500 /ADDRESS:(ip address) /MAX_SECTORS:(num sectors)\n\n");
return 1;
}
}
}
ip_address = inet_addr(address);
if ((port < 3500) || (port > 32767))
{
#ifdef WIN32
::MessageBox(NULL, "Invalid /PORT specified for Sector Server.", "Net7", MB_ICONERROR);
#else
printf("Invalid /PORT specified for Sector Server.\n");
#endif
return 1;
}
if ((max_sectors < 1) || (max_sectors > 128))
{
#ifdef WIN32
::MessageBox(NULL, "Invalid /MAX_SECTORS specified for Sector Server.", "Net7", MB_ICONERROR);
#else
printf("Invalid /MAX_SECTORS specified for Sector Server.\n");
#endif
return 1;
}
#ifdef WIN32
// First, make sure we only have one instance of the Global Server running
HANDLE instance_mutex = ::CreateMutex(NULL, TRUE, mutex_name);
if (instance_mutex == INVALID_HANDLE_VALUE)
{
::MessageBox(NULL, "Error creating instance mutex.", "Net7", MB_ICONERROR);
return 1;
}
// if we did not create this mutex then .. another instance
// is already running
if (::GetLastError() == ERROR_ALREADY_EXISTS)
{
// close the mutex
::CloseHandle(instance_mutex);
::MessageBox(NULL, "Another instance of the Net-7 Server is already running.", "Net7", MB_ICONERROR);
return 1;
}
#endif
{
//.........这里部分代码省略.........
示例9: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR szCmdLine, int iCmdShow)
#endif
{
/*HMODULE hUser32 = LoadLibrary(_T("user32.dll"));
typedef BOOL(*SetProcessDPIAwareFunc)();
SetProcessDPIAwareFunc setDPIAware=NULL;
if (hUser32) setDPIAware = (SetProcessDPIAwareFunc)GetProcAddress(hUser32, "SetProcessDPIAware");
if (setDPIAware) setDPIAware();
if (hUser32) FreeLibrary(hUser32);*/
#ifdef IPP
InitIpp();
#endif
#ifdef CRASHRPT
CR_INSTALL_INFO info;
memset(&info, 0, sizeof(CR_INSTALL_INFO));
info.cb = sizeof(CR_INSTALL_INFO);
info.pszAppName = _T("UVNC");
info.pszAppVersion = _T("1.2.1.1");
info.pszEmailSubject = _T("UVNC viewer 1.2.1.1 Error Report");
info.pszEmailTo = _T("[email protected]");
info.uPriorities[CR_SMAPI] = 1; // Third try send report over Simple MAPI
// Install all available exception handlers
info.dwFlags |= CR_INST_ALL_POSSIBLE_HANDLERS;
// Restart the app on crash
info.dwFlags |= CR_INST_APP_RESTART;
info.dwFlags |= CR_INST_SEND_QUEUED_REPORTS;
info.dwFlags |= CR_INST_AUTO_THREAD_HANDLERS;
info.pszRestartCmdLine = _T("/restart");
// Define the Privacy Policy URL
// Install crash reporting
int nResult = crInstall(&info);
if (nResult != 0)
{
// Something goes wrong. Get error message.
TCHAR szErrorMsg[512] = _T("");
crGetLastErrorMsg(szErrorMsg, 512);
_tprintf_s(_T("%s\n"), szErrorMsg);
return 1;
}
#endif
setbuf(stderr, 0);
bool console = false;
m_hInstResDLL = NULL;
// [v1.0.2-jp1 fix]
//m_hInstResDLL = LoadLibrary("lang.dll");
HMODULE hmod;
HKEY hkey;
if((hmod=GetModuleHandle("kernel32.dll")))
{
MySetDllDirectory = (LPFNSETDLLDIRECTORY)GetProcAddress(hmod, "SetDllDirectoryA");
if(MySetDllDirectory) MySetDllDirectory("");
else
{
OSVERSIONINFO osinfo;
osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osinfo);
if((osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion == 0 && strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) ||
(osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion == 1 && strcmp(osinfo.szCSDVersion, "") >= 0))
{
DWORD regval = 1;
DWORD reglen = sizeof(DWORD);
vnclog.Print(3,"Using Win2k (SP3+) / WinXP (No SP).. Checking SafeDllSearch\n");
read_reg_string(HKEY_LOCAL_MACHINE,
"System\\CurrentControlSet\\Control\\Session Manager",
"SafeDllSearchMode",
(LPBYTE)®val,
®len);
if(regval != 0) {
vnclog.Print(3,"Trying to set SafeDllSearchMode to 0\n");
regval = 0;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"System\\CurrentControlSet\\Control\\Session Manager",
0, KEY_SET_VALUE, &hkey) == ERROR_SUCCESS) {
if(RegSetValueEx(hkey,
"SafeDllSearchMode",
0,
REG_DWORD,
(LPBYTE) ®val,
sizeof(DWORD)) != ERROR_SUCCESS)
vnclog.Print(3,"Error writing SafeDllSearchMode. Error: %u\n",(UINT)GetLastError());
RegCloseKey(hkey);
}
else
vnclog.Print(3,"Error opening Session Manager key for writing. Error: %u\n",(UINT)GetLastError());
}
else
vnclog.Print(3,"SafeDllSearchMode is set to 0\n");
}
}
//.........这里部分代码省略.........