Module: WinRM

Defined in:
lib/winrm.rb,
lib/winrm/output.rb,
lib/winrm/version.rb,
lib/winrm/psrp/uuid.rb,
lib/winrm/wsmv/base.rb,
lib/winrm/wsmv/soap.rb,
lib/winrm/connection.rb,
lib/winrm/exceptions.rb,
lib/winrm/shells/cmd.rb,
lib/winrm/shells/base.rb,
lib/winrm/wsmv/header.rb,
lib/winrm/psrp/message.rb,
lib/winrm/wsmv/command.rb,
lib/winrm/compat_logger.rb,
lib/winrm/psrp/fragment.rb,
lib/winrm/wsmv/wql_pull.rb,
lib/winrm/http/transport.rb,
lib/winrm/wsmv/send_data.rb,
lib/winrm/wsmv/wql_query.rb,
lib/winrm/connection_opts.rb,
lib/winrm/wsmv/keep_alive.rb,
lib/winrm/shells/retryable.rb,
lib/winrm/wsmv/close_shell.rb,
lib/winrm/wsmv/write_stdin.rb,
lib/winrm/psrp/message_data.rb,
lib/winrm/wsmv/create_shell.rb,
lib/winrm/shells/power_shell.rb,
lib/winrm/wsmv/configuration.rb,
lib/winrm/wsmv/command_output.rb,
lib/winrm/psrp/message_factory.rb,
lib/winrm/shells/shell_factory.rb,
lib/winrm/wsmv/cleanup_command.rb,
lib/winrm/wsmv/create_pipeline.rb,
lib/winrm/http/response_handler.rb,
lib/winrm/wsmv/iso8601_duration.rb,
lib/winrm/http/transport_factory.rb,
lib/winrm/psrp/message_data/base.rb,
lib/winrm/psrp/message_fragmenter.rb,
lib/winrm/wsmv/init_runspace_pool.rb,
lib/winrm/psrp/message_defragmenter.rb,
lib/winrm/wsmv/command_output_decoder.rb,
lib/winrm/psrp/receive_response_reader.rb,
lib/winrm/wsmv/receive_response_reader.rb,
lib/winrm/psrp/message_data/error_record.rb,
lib/winrm/psrp/powershell_output_decoder.rb,
lib/winrm/psrp/message_data/pipeline_state.rb,
lib/winrm/psrp/message_data/pipeline_output.rb,
lib/winrm/psrp/message_data/pipeline_host_call.rb,
lib/winrm/psrp/message_data/runspacepool_state.rb,
lib/winrm/psrp/message_data/session_capability.rb,
lib/winrm/psrp/message_data/runspacepool_host_call.rb

Overview

Copyright 2016 Matt Wrock [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Modules: HTTP, PSRP, Shells, WSMV Classes: CompatLogger, Connection, ConnectionOpts, InvalidExitCode, InvalidShellError, InvalidTransportError, Output, ResponseHandler, WinRMAuthorizationError, WinRMError, WinRMHTTPTransportError, WinRMSoapFault, WinRMWMIError, WinRMWSManFault

Constant Summary collapse

LOG_LEVELS =
%w[debug info warn error fatal].freeze
VERSION =

The version of the WinRM library

'2.4.0'.freeze

Class Method Summary collapse

Class Method Details

.default_log_levelSymbol

Default log level used by WinRM loggers, controlled by the WINRM_LOG environment variable. Falls back to :warn when unset or invalid.

Returns:

  • (Symbol)

    One of :debug, :info, :warn, :error or :fatal



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/winrm.rb', line 29

def self.default_log_level
  level = ENV.fetch('WINRM_LOG', '').downcase
  return :warn if level.empty?

  unless LOG_LEVELS.include?(level)
    warn "Invalid WINRM_LOG level is set: #{ENV.fetch('WINRM_LOG', nil)}"
    warn ''
    warn 'Please use one of the standard log levels: ' \
      'debug, info, warn, or error'
    return :warn
  end

  level.to_sym
end