Module: LoggerForRubyScriptProvider

Defined in:
lib/rubyscriptprovider.rb

Constant Summary collapse

PROVIDER_DEBUG_FLAG =
"#{RubyScriptProvider::NAME}Debug"
PROVIDER_DEBUG_OUTPUT =
"#{PROVIDER_DEBUG_FLAG}Output"
LOG_DEFAULT_PATH =
"$(user)/temp/#{PROVIDER_DEBUG_OUTPUT}.txt"
@@log =
Logger.new(
  case ENV.fetch(LOADER_DEBUG_OUTPUT, "STDOUT")
  when "STDOUT"
    STDOUT
  when "FILE"
    Uno.to_system_path(
      Runo.get_component_context.getServiceManager.
        createInstanceWithContext(
          "com.sun.star.util.PathSubstitution", 
          Runo.get_component_context).
            substituteVariables(LOG_DEFAULT_PATH, true))
  else
    ENV.fetch(LOADER_DEBUG_OUTPUT)
  end
)