Added NSIS_CONFIG_LOG_ODS that makes the log use OutputDebugString instead of install.log.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3194 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-11-24 14:22:50 +00:00
parent c49208b861
commit ac025c139c
6 changed files with 49 additions and 10 deletions

View file

@ -221,7 +221,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
ret = ui_doinstall();
#ifdef NSIS_CONFIG_LOG
#ifndef NSIS_CONFIG_LOG_ODS
log_write(1);
#endif//!NSIS_CONFIG_LOG_ODS
#endif//NSIS_CONFIG_LOG
end:

View file

@ -123,11 +123,13 @@ static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lPara
#endif//!NSIS_CONFIG_ENHANCEDUI_SUPPORT
#ifdef NSIS_CONFIG_LOG
#ifndef NSIS_CONFIG_LOG_ODS
void NSISCALL build_g_logfile()
{
lstrcat(addtrailingslash(mystrcpy(g_log_file,state_install_directory)),"install.log");
}
#endif
#endif
int *cur_langtable;
@ -225,7 +227,9 @@ int NSISCALL ui_doinstall(void)
#ifdef NSIS_CONFIG_LOG
if (g_flags & CH_FLAGS_SILENT_LOG && !g_is_uninstaller)
{
#ifndef NSIS_CONFIG_LOG_ODS
build_g_logfile();
#endif
log_dolog=1;
}
#endif
@ -754,7 +758,9 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
GetUIText(IDC_DIR,dir,NSIS_MAX_STRLEN);
validate_filename(dir);
#ifdef NSIS_CONFIG_LOG
#ifndef NSIS_CONFIG_LOG_ODS
build_g_logfile();
#endif
log_dolog = IsDlgButtonChecked(hwndDlg,IDC_CHECK1);
#endif
}

View file

@ -115,7 +115,12 @@
// turning this on (by uncommenting it) adds about
// 4kb, but can be useful in debugging your installers.
// NOT ENABLED BY DEFAULT.
//#define NSIS_CONFIG_LOG
// #define NSIS_CONFIG_LOG
// NSIS_CONFIG_LOG_ODS makes the logging facility
// use OutputDebugString instead of a file.
// NOT ENABLED BY DEFAULT.
// #define NSIS_CONFIG_LOG_ODS
// NSIS_SUPPORT_BGBG enables support for the blue (well, whatever
// color you want) gradient background window.
@ -275,6 +280,11 @@
#endif
#endif
#ifdef NSIS_CONFIG_LOG_ODS
#ifndef NSIS_CONFIG_LOG
#error NSIS_CONFIG_LOG_ODS relies on NSIS_CONFIG_LOG, but NSIS_CONFIG_LOG is not defined
#endif
#endif
#if defined(NSIS_CONFIG_CRC_SUPPORT) && defined(NSIS_CONFIG_VISIBLE_SUPPORT)
#define _NSIS_CONFIG_VERIFYDIALOG

View file

@ -1476,7 +1476,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
log_printf2("settings logging to %d",parm1);
log_dolog=parm1;
log_printf2("logging set to %d",parm1);
#ifndef NSIS_CONFIG_LOG_ODS
if (parm1) build_g_logfile();
#endif
}
else
{

View file

@ -11,8 +11,10 @@
#include "ui.h"
#ifdef NSIS_CONFIG_LOG
#ifndef NSIS_CONFIG_LOG_ODS
char g_log_file[1024];
#endif
#endif
#ifdef NSIS_SUPPORT_NAMED_USERVARS
// *** DO NOT DECLARE MORE VARIABLES INSIDE THIS PRAGMAS ***
@ -722,11 +724,12 @@ char * NSISCALL validate_filename(char *in) {
}
#ifdef NSIS_CONFIG_LOG
char log_text[4096];
int log_dolog;
char log_text[NSIS_MAX_STRLEN*4];
#ifndef NSIS_CONFIG_LOG_ODS
void NSISCALL log_write(int close)
{
extern char g_log_file[1024];
static HANDLE fp=INVALID_HANDLE_VALUE;
if (close)
{
@ -753,7 +756,22 @@ void NSISCALL log_write(int close)
}
}
}
#endif//!NSIS_CONFIG_LOG_ODS
void log_printf(char *format, ...)
{
va_list val;
va_start(val,format);
wvsprintf(log_text,format,val);
va_end(val);
#ifdef NSIS_CONFIG_LOG_ODS
if (log_dolog)
OutputDebugString(log_text);
#else
log_write(0);
#endif
}
#endif//NSIS_CONFIG_LOG
WIN32_FIND_DATA * NSISCALL file_exists(char *buf)
{

View file

@ -25,13 +25,14 @@ BOOL NSISCALL my_SetDialogItemText(HWND dlg, UINT idx, const char *val);
#ifdef NSIS_CONFIG_LOG
extern char log_text[NSIS_MAX_STRLEN*4];
void NSISCALL log_write(int close);
#define log_printf(x1) wsprintf(log_text,x1); log_write(0)
#define log_printf2(x1,x2) wsprintf(log_text,x1,x2); log_write(0)
#define log_printf3(x1,x2,x3) wsprintf(log_text,x1,x2,x3); log_write(0)
#define log_printf4(x1,x2,x3,x4) wsprintf(log_text,x1,x2,x3,x4); log_write(0)
#define log_printf5(x1,x2,x3,x4,x5) wsprintf(log_text,x1,x2,x3,x4,x5); log_write(0)
#define log_printf6(x1,x2,x3,x4,x5,x6) wsprintf(log_text,x1,x2,x3,x4,x5,x6); log_write(0)
#define log_printf8(x1,x2,x3,x4,x5,x6,x7,x8) wsprintf(log_text,x1,x2,x3,x4,x5,x6,x7,x8); log_write(0)
void log_printf(char *format, ...);
#define log_printf2(x1,x2) wsprintf(log_text,x1,x2);
#define log_printf3(x1,x2,x3) wsprintf(log_text,x1,x2,x3);
#define log_printf4(x1,x2,x3,x4) wsprintf(log_text,x1,x2,x3,x4);
#define log_printf5(x1,x2,x3,x4,x5) wsprintf(log_text,x1,x2,x3,x4,x5);
#define log_printf6(x1,x2,x3,x4,x5,x6) wsprintf(log_text,x1,x2,x3,x4,x5,x6);
#define log_printf6(x1,x2,x3,x4,x5,x6,x7) wsprintf(log_text,x1,x2,x3,x4,x5,x6,x7);
#define log_printf8(x1,x2,x3,x4,x5,x6,x7,x8) wsprintf(log_text,x1,x2,x3,x4,x5,x6,x7,x8);
extern int log_dolog;
extern char g_log_file[1024];
#else