FEI Version of the Day
Loading...
Searching...
No Matches
fei_LogManager.cpp
1/*--------------------------------------------------------------------*/
2/* Copyright 2005 Sandia Corporation. */
3/* Under the terms of Contract DE-AC04-94AL85000, there is a */
4/* non-exclusive license for use of this work by or on behalf */
5/* of the U.S. Government. Export of this program may require */
6/* a license from the United States Government. */
7/*--------------------------------------------------------------------*/
8
9#include <fei_utils.hpp>
10#include <fei_LogManager.hpp>
11#include <fei_Logger.hpp>
12#include <fei_LogFile.hpp>
13
14fei::LogManager::LogManager()
15 : output_level_(NONE),
16 output_path_("./")
17{
18}
19
23
25{
26 static fei::LogManager log_manager;
27 return(log_manager);
28}
29
31{
32 return(output_level_);
33}
34
36{
37 if (output_level_ == olevel) {
38 return;
39 }
40
41 bool no_existing_output_stream = output_level_ < fei::BRIEF_LOGS;
42
43 output_level_ = olevel;
44
45 bool need_output_stream = output_level_ >= fei::BRIEF_LOGS;
46
47 if (need_output_stream && no_existing_output_stream) {
48 fei::LogFile::getLogFile().openOutputStream(output_path_.c_str(),
49 numProcs_, localProc_);
50 }
51}
52
53void fei::LogManager::setOutputLevel(const char* olevel)
54{
55 setOutputLevel(fei::utils::string_to_output_level(olevel));
56}
57
58void fei::LogManager::setOutputPath(const std::string& opath)
59{
60 output_path_ = opath;
61}
62
64{
65 return(output_path_);
66}
67
68void fei::LogManager::setNumProcs(int nprocs, int localproc)
69{
70 numProcs_ = nprocs;
71 localProc_ = localproc;
72}
73
void openOutputStream(const char *path=NULL, int nprocs=1, int localproc=0)
static LogFile & getLogFile()
void setOutputLevel(OutputLevel olevel)
static LogManager & getLogManager()
const std::string & getOutputPath()
void setOutputPath(const std::string &opath)
void setNumProcs(int nprocs, int localproc)
OutputLevel getOutputLevel()
fei::OutputLevel string_to_output_level(const std::string &str)
Definition fei_utils.cpp:58
OutputLevel
Definition fei_fwd.hpp:81