Module: NexusCli::LoggingActions

Included in:
OSSRemote, ProRemote
Defined in:
lib/nexus_cli/mixins/logging_actions.rb

Overview

Author:

Instance Method Summary collapse

Instance Method Details

#get_logging_infoString

Gets information about the current logging levels in Nexus.

Returns:

  • (String)

    a String of JSON representing the current logging levels of Nexus



10
11
12
13
14
15
16
17
18
# File 'lib/nexus_cli/mixins/logging_actions.rb', line 10

def get_logging_info
  response = nexus.get(nexus_url("service/local/log/config"), :header => DEFAULT_ACCEPT_HEADER)
  case response.status
  when 200
    return response.content
  else
    raise UnexpectedStatusCodeException.new(response.status)
  end
end

#set_logger_level(level) ⇒ Boolean

Sets the logging level of Nexus to one of “INFO”, “DEBUG”, or “ERROR”.

Parameters:

  • level (String)

    the logging level to set

Returns:

  • (Boolean)

    true if the logging level has been set, false otherwise

Raises:



27
28
29
30
31
32
33
34
35
36
# File 'lib/nexus_cli/mixins/logging_actions.rb', line 27

def set_logger_level(level)
  raise InvalidLoggingLevelException unless ["INFO", "DEBUG", "ERROR"].include?(level.upcase)
  response = nexus.put(nexus_url("service/local/log/config"), :body => create_logger_level_json(level), :header => DEFAULT_CONTENT_TYPE_HEADER)
  case response.status
  when 200
    return true
  else
    raise UnexpectedStatusCodeException.new(response.status)
  end
end