FACT++  1.0
int DataLogger::EvalOptions ( Configuration conf)

Setup Logger's configuration from a Configuration object

Parameters
confthe configuration object that should be used

Definition at line 2234 of file datalogger.cc.

References backLogBuffer, CompileFileNameWithPath(), MessageImp::Error(), fShouldAutoStart, Configuration::Get(), Configuration::Has(), NotifyOpenedFile(), OpenTextFile(), DimWriteStatistics::SetCurrentFolder(), DimWriteStatistics::SetDebugMode(), DimWriteStatistics::SetUpdateInterval(), shouldBackLog, and Configuration::Vec().

2235 {
2236  fDebugIsOn = conf.Get<bool>("debug");
2238 
2239  //Set the block or allow list
2240  fBlackList.clear();
2241  fWhiteList.clear();
2242 
2243  //Adding entries that should ALWAYS be ignored
2244  fBlackList.insert("DATA_LOGGER/MESSAGE");
2245  fBlackList.insert("DATA_LOGGER/SUBSCRIPTIONS");
2246  fBlackList.insert("/SERVICE_LIST");
2247  fBlackList.insert("DIS_DNS/");
2248 
2249  //set the black list, white list and the goruping
2250  const vector<string> vec1 = conf.Vec<string>("block");
2251  const vector<string> vec2 = conf.Vec<string>("allow");
2252  const vector<string> vec3 = conf.Vec<string>("group");
2253 
2254  fBlackList.insert(vec1.begin(), vec1.end());
2255  fWhiteList.insert(vec2.begin(), vec2.end());
2256  fGrouping.insert( vec3.begin(), vec3.end());
2257 
2258  //set the old run numbers timeout delay
2259  if (conf.Has("run-timeout"))
2260  {
2261  const uint32_t timeout = conf.Get<uint32_t>("run-timeout");
2262  if (timeout == 0)
2263  {
2264  Error("Time out delay for old run numbers must not be 0.");
2265  return 1;
2266  }
2267  fRunNumberTimeout = timeout;
2268  }
2269 
2270  //configure the run files directory
2271  if (conf.Has("destination-folder"))
2272  {
2273  const string folder = conf.Get<string>("destination-folder");
2274  if (!fFilesStats.SetCurrentFolder(folder))
2275  return 2;
2276 
2277  fFilePath = folder;
2280  return 3;
2281 
2282  fNightlyLogFile << endl;
2284  for (vector<string>::iterator it=backLogBuffer.begin();it!=backLogBuffer.end();it++)
2285  fNightlyLogFile << *it;
2286  }
2287 
2288  shouldBackLog = false;
2289  backLogBuffer.clear();
2290 
2291  //configure the interval between statistics updates
2292  if (conf.Has("stats-interval"))
2293  fFilesStats.SetUpdateInterval(conf.Get<int16_t>("stats-interval"));
2294 
2295  //configure if the filenames service is on or off
2296  fOpenedFilesIsOn = !conf.Get<bool>("no-filename-service");
2297 
2298  //configure if the number of subscriptions and fits files is on or off.
2299  fNumSubAndFitsIsOn = !conf.Get<bool>("no-numsubs-service");
2300  //should we open the daily files at startup ?
2301  if (conf.Has("start-daily-files"))
2302  if (conf.Get<bool>("start-daily-files"))
2303  {
2304  fShouldAutoStart = true;
2305  }
2306  if (conf.Has("service-list-interval"))
2307  fCurrentSubscriptionUpdateRate = conf.Get<int32_t>("service-list-interval");
2308  return -1;
2309 }
DimWriteStatistics fFilesStats
Definition: datalogger.cc:235
int fCurrentSubscriptionUpdateRate
Number of seconds since the last update of the subscribed list.
Definition: datalogger.cc:299
void NotifyOpenedFile(const string &name, int type, DimDescribedService *service)
Definition: datalogger.cc:1781
ofstream fNightlyLogFile
ofstream for the NightlyLogfile
Definition: datalogger.cc:203
T Get(const std::string &var)
bool fDebugIsOn
configuration flags
Definition: datalogger.cc:315
bool shouldBackLog
Definition: datalogger.cc:392
string fFilePath
ofstream for the Nightly report file
Definition: datalogger.cc:209
set< string > fBlackList
black/white listing
Definition: datalogger.cc:310
std::vector< T > Vec(const std::string &var)
bool fNumSubAndFitsIsOn
Definition: datalogger.cc:317
DimDescribedService * fOpenedNightlyFiles
Service for opened files.
Definition: datalogger.cc:291
void SetUpdateInterval(const int16_t millisec)
bool Has(const std::string &var)
uint32_t fRunNumberTimeout
old run numbers time-out delay (in seconds)
Definition: datalogger.cc:213
int Error(const std::string &str)
Definition: MessageImp.h:49
vector< string > backLogBuffer
Definition: datalogger.cc:391
bool fShouldAutoStart
Definition: datalogger.cc:393
bool OpenTextFile(ofstream &stream, const string &name)
Subscribe to a given server and service.
Definition: datalogger.cc:782
bool fOpenedFilesIsOn
Definition: datalogger.cc:316
set< string > fWhiteList
Definition: datalogger.cc:311
bool SetCurrentFolder(const std::string &folder)
Configures that current folder where files are written to.
string fFullNightlyLogFileName
full name of the nightly log file
Definition: datalogger.cc:226
set< string > fGrouping
list of services to be grouped
Definition: datalogger.cc:313
string CompileFileNameWithPath(const string &path, const string &service, const string &extension)
Get the digits of year, month and day for filenames and paths.
Definition: datalogger.cc:851

+ Here is the call graph for this function: