summaryrefslogtreecommitdiff
path: root/src/main/WarnLevel.c
diff options
context:
space:
mode:
authortradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2005-12-13 16:31:40 +0000
committertradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2005-12-13 16:31:40 +0000
commit7f15e27e3dea623fefa485f04f3634289b3c626d (patch)
treef7bc0381b6b1a3ff2fdc7bbc441f20e1940abb1f /src/main/WarnLevel.c
parentdcbc845fb891a1d10476408f6e6cd517389f8dab (diff)
Extend CCTK_VWarn() so that, if Cactus::cctk_full_warnings is set to true,
it also prints the hostname of the originating warning message. This information comes in handy when debugging a problem on clusters by directly logging into the nodes. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4214 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/WarnLevel.c')
-rw-r--r--src/main/WarnLevel.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/WarnLevel.c b/src/main/WarnLevel.c
index b052f9dd..ffcad740 100644
--- a/src/main/WarnLevel.c
+++ b/src/main/WarnLevel.c
@@ -35,6 +35,7 @@
#include "cctki_WarnLevel.h"
#include "util_String.h"
+#include "util_Network.h"
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(main_WarnLevel_c);
@@ -53,6 +54,8 @@ CCTK_FILEVERSION(main_WarnLevel_c);
#define BOLD_OFF ""
#endif
+/* maximum buffer length to hold the hostname */
+#define MAXNAMELEN 255
/********************************************************************
********************* External Routines **********************
@@ -471,6 +474,7 @@ int CCTK_VWarn (int level,
int msg_size;
char *message = NULL;
+ char hostname[MAXNAMELEN+1];
/* Start generating message only if the warbcallback list is not NULL */
if(warncallbacks)
@@ -503,6 +507,7 @@ int CCTK_VWarn (int level,
{
myproc = CCTK_MyProc(NULL);
+ Util_GetHostName (hostname, MAXNAMELEN);
cctk_full_warnings_ptr =
CCTK_ParameterGet ("cctk_full_warnings", "Cactus", &param_type);
@@ -534,10 +539,10 @@ int CCTK_VWarn (int level,
if (level <= error_level || cctk_full_warnings)
{
- fprintf (stderr, "WARNING level %d in thorn %s processor %d\n"
+ fprintf (stderr, "WARNING level %d in thorn %s processor %d host %s\n"
" (line %d of %s): \n"
" ->",
- level, thorn, myproc, line, file);
+ level, thorn, myproc, hostname, line, file);
}
else
{
@@ -567,10 +572,10 @@ int CCTK_VWarn (int level,
if (level <= error_level || cctk_full_warnings)
{
- fprintf (stdout, "WARNING level %d in thorn %s processor %d\n"
+ fprintf (stdout, "WARNING level %d in thorn %s processor %d host %s\n"
" (line %d of %s): \n"
" ->",
- level, thorn, myproc, line, file);
+ level, thorn, myproc, hostname, line, file);
}
else
{