Project

General

Profile

0001-Use-MF_PLUGIN_PATH-env-var-for-plugins-is-present.patch

Ben Morgan, 11/20/2017 09:38 AM

View differences:

messagefacility/MessageLogger/MessageLoggerScribe.cc
4 4

  
5 5
#include "cetlib/HorizontalRule.h"
6 6
#include "cetlib/container_algorithms.h"
7
#include "cetlib/os_libpath.h"
7 8
#include "cetlib/trim.h"
8 9
#include "fhiclcpp/make_ParameterSet.h"
9 10
#include "fhiclcpp/types/detail/validationException.h"
......
54 55
    return result;
55 56
  }
56 57

  
58
  auto runtime_plugin_searchpath()
59
  {
60
    // https://cdcvs.fnal.gov/redmine/issues/17900
61
    // 1. Use `MF_PLUGIN_PATH` if set in the environment.
62
    // 2. Else use system loader path
63
    try {
64
      return cet::search_path{"MF_PLUGIN_PATH"};
65
    }
66
    catch (cet::exception const& e){
67
      // Check category is "getenv"?
68
    }
69
    // If we get to here, use default
70
    return cet::search_path{cet::os_libpath()};
71
  }
57 72
}
58 73

  
59 74
namespace mf {
60 75
  namespace service {
61 76

  
62 77
    MessageLoggerScribe::MessageLoggerScribe()
63
    try : earlyDest_{admin_.attach("cerr_early", makePlugin_(pluginFactory_,
78
    try : pluginFactory_{runtime_plugin_searchpath(), "mfPlugin"},
79
          pluginStatsFactory_{runtime_plugin_searchpath(), "mfStatsPlugin"},
80
          earlyDest_{admin_.attach("cerr_early", makePlugin_(pluginFactory_,
64 81
                                                             "cerr",
65 82
                                                             "cerr_early",
66 83
                                                             default_destination_config()))}
messagefacility/MessageLogger/MessageLoggerScribe.h
57 57

  
58 58
      // --- data:
59 59
      ELadministrator admin_{};
60
      cet::BasicPluginFactory pluginFactory_{"mfPlugin"};
61
      cet::BasicPluginFactory pluginStatsFactory_{"mfStatsPlugin"};
60
      cet::BasicPluginFactory pluginFactory_;
61
      cet::BasicPluginFactory pluginStatsFactory_;
62 62
      ELdestination& earlyDest_;
63 63
      bool cleanSlateConfiguration_{true};
64 64
      bool active_{true};
65
-