Ignore:
Timestamp:
01/23/15 16:18:43 (9 years ago)
Author:
rlacroix
Message:

Backport r523 into the stable branch.

Improve the message error handling by mimicking the behavior of the info/report logs.

Output the error messages to the standart error message until the context is correctly initialized. Then, output the error messages to a file if the user has set "print_file" parameter to "true".

  • Fix: Errors that occured before MPI was initialized (e.g. during the config file parsing) caused a MPI error on top of the original error.
  • Fix: The error file could sometimes be misnamed if the error happened before the context was completely known.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-1.0/src/log.hpp

    r501 r548  
    1313  { 
    1414    public : 
    15     CLog(const string& name_) : ostream(cout.rdbuf()),level(0),name(name_), strBuf_(cout.rdbuf()) {} 
     15    CLog(const string& name_, std::streambuf* sBuff = cout.rdbuf()) 
     16      : ostream(sBuff), level(0), name(name_), strBuf_(sBuff) {} 
    1617    CLog& operator()(int l) 
    1718    { 
     
    3031 
    3132  public: 
    32     //! Write info into a file with its streambuf 
     33    //! Write log into a file with its streambuf 
    3334    void write2File(std::streambuf* sBuff) { changeStreamBuff(sBuff); } 
    3435 
    35     //! Write info into standard output 
     36    //! Write log into standard output 
    3637    void write2StdOut() { changeStreamBuff(cout.rdbuf()); } 
     38 
     39    //! Write log into standard error output 
     40    void write2StdErr() { changeStreamBuff(cerr.rdbuf()); } 
     41 
    3742  private: 
    3843    /*! 
     
    4348    void changeStreamBuff(std::streambuf* sBuff) { strBuf_ = sBuff; rdbuf(sBuff); } 
    4449 
    45     private : 
    4650    int level ; 
    4751    string name ; 
     
    5155  extern CLog info; 
    5256  extern CLog report; 
     57  extern CLog error; 
    5358} 
    5459#endif 
Note: See TracChangeset for help on using the changeset viewer.