output messages that would otherwise only show up in logs only when logs are enable for screen or logfile

This commit is contained in:
Axel Kohlmeyer
2019-06-23 14:13:24 -04:00
parent 27d1f79fe3
commit c6d0f807b5
3 changed files with 14 additions and 12 deletions

View File

@ -363,8 +363,8 @@ void KimInit::kim_init_log_delimiter(std::string const begin_end) const
mesg =
"#=== END kim-init ============================================\n\n";
if (screen) fputs(mesg.c_str(),screen);
if (logfile) fputs(mesg.c_str(),logfile);
if ((screen) && (input->echo_screen)) fputs(mesg.c_str(),screen);
if ((logfile) && (input->echo_log)) fputs(mesg.c_str(),logfile);
}
}
@ -411,8 +411,8 @@ void KimInit::do_variables(char *user_units, char *model_units)
mesg += " to ";
mesg += to;
mesg += ":\n";
if (screen) fputs(mesg.c_str(),screen);
if (logfile) fputs(mesg.c_str(),logfile);
if ((screen) && (input->echo_screen)) fputs(mesg.c_str(),screen);
if ((logfile) && (input->echo_log)) fputs(mesg.c_str(),logfile);
}
for (int i = 0; i < nunits; i++) {
@ -441,12 +441,12 @@ void KimInit::do_variables(char *user_units, char *model_units)
<< " internal "
<< std::setprecision(12) << std::scientific << conversion_factor
<< std::endl;
if (screen) fputs(mesg.str().c_str(),screen);
if (logfile) fputs(mesg.str().c_str(),logfile);
if ((screen) && (input->echo_screen)) fputs(mesg.str().c_str(),screen);
if ((logfile) && (input->echo_log)) fputs(mesg.str().c_str(),logfile);
}
}
if (comm->me == 0) {
if (screen) fputs("#\n",screen);
if (logfile) fputs("#\n",logfile);
if ((screen) && (input->echo_screen)) fputs("#\n",screen);
if ((logfile) && (input->echo_log)) fputs("#\n",logfile);
}
}

View File

@ -109,8 +109,8 @@ void KimInteractions::kim_interactions_log_delimiter(
mesg =
"#=== END kim_interactions ====================================\n\n";
if (screen) fputs(mesg.c_str(),screen);
if (logfile) fputs(mesg.c_str(),logfile);
if ((screen) && (input->echo_screen)) fputs(mesg.c_str(),screen);
if ((logfile) && (input->echo_log)) fputs(mesg.c_str(),logfile);
}
}

View File

@ -25,6 +25,8 @@ class Input : protected Pointers {
friend class Info;
friend class Error;
friend class Deprecated;
friend class KimInit;
friend class KimInteractions;
public:
int narg; // # of command args
@ -42,14 +44,14 @@ class Input : protected Pointers {
protected:
char *command; // ptr to current command
int echo_screen; // 0 = no, 1 = yes
int echo_log; // 0 = no, 1 = yes
private:
int me; // proc ID
int maxarg; // max # of args in arg
char *line,*copy,*work; // input line & copy and work string
int maxline,maxcopy,maxwork; // max lengths of char strings
int echo_screen; // 0 = no, 1 = yes
int echo_log; // 0 = no, 1 = yes
int nfile,maxfile; // current # and max # of open input files
int label_active; // 0 = no label, 1 = looking for label
char *labelstr; // label string being looked for