2007-07-28 03:11:00 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pml_v_output.h"
|
|
|
|
|
2007-08-16 09:52:30 +04:00
|
|
|
#if defined(HAVE_UNISTD_H)
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int pml_v_output = -1;
|
|
|
|
|
2007-08-14 21:17:12 +04:00
|
|
|
int pml_v_output_open(char *output, int verbosity) {
|
2007-07-28 03:11:00 +04:00
|
|
|
opal_output_stream_t lds;
|
|
|
|
char hostname[32] = "NA";
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&lds, opal_output_stream_t);
|
|
|
|
if(!output) {
|
2007-08-16 09:52:30 +04:00
|
|
|
pml_v_output = 0;
|
2007-07-28 03:11:00 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(!strcmp(output, "stdout")) {
|
|
|
|
lds.lds_want_stdout = true;
|
|
|
|
}
|
|
|
|
else if(!strcmp(output, "stderr")) {
|
|
|
|
lds.lds_want_stderr = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lds.lds_want_file = true;
|
|
|
|
lds.lds_file_suffix = output;
|
|
|
|
}
|
|
|
|
lds.lds_is_debugging = true;
|
|
|
|
gethostname(hostname, 32);
|
|
|
|
asprintf(&lds.lds_prefix, "[%s:%05d] pml_v: ", hostname, getpid());
|
|
|
|
lds.lds_verbose_level = verbosity;
|
2007-08-16 09:52:30 +04:00
|
|
|
pml_v_output = opal_output_open(&lds);
|
2007-07-28 03:11:00 +04:00
|
|
|
free(lds.lds_prefix);
|
|
|
|
}
|
2007-08-16 09:52:30 +04:00
|
|
|
return pml_v_output;
|
2007-07-28 03:11:00 +04:00
|
|
|
}
|
|
|
|
|
2007-08-14 21:17:12 +04:00
|
|
|
void pml_v_output_close(void) {
|
2007-08-16 09:52:30 +04:00
|
|
|
opal_output_close(pml_v_output);
|
2007-07-28 03:11:00 +04:00
|
|
|
}
|