Module: PuppetEditorServices
- Defined in:
- lib/puppet_editor_services/server/tcp.rb,
lib/puppet_editor_services/server.rb,
lib/puppet_editor_services/logging.rb,
lib/puppet_editor_services/version.rb,
lib/puppet_editor_services/server/base.rb,
lib/puppet_editor_services/handler/base.rb,
lib/puppet_editor_services/server/stdio.rb,
lib/puppet_editor_services/protocol/base.rb,
lib/puppet_editor_services/connection/tcp.rb,
lib/puppet_editor_services/connection/base.rb,
lib/puppet_editor_services/connection/stdio.rb,
lib/puppet_editor_services/handler/json_rpc.rb,
lib/puppet_editor_services/protocol/json_rpc.rb,
lib/puppet_editor_services/handler/debug_adapter.rb,
lib/puppet_editor_services/protocol/debug_adapter.rb,
lib/puppet_editor_services/protocol/json_rpc_messages.rb,
lib/puppet_editor_services/protocol/debug_adapter_messages.rb
Overview
Defined Under Namespace
Modules: Connection, Handler, Protocol, Server
Constant Summary collapse
- PUPPETEDITORSERVICESVERSION =
'2.0.4'
Class Method Summary collapse
- .init_logging(options) ⇒ Object
- .log_message(severity, message) ⇒ Object
-
.version ⇒ String
Containing the editor services version, e.g.
-
.version=(version) ⇒ void
private
Sets the editor services version Typically only used in testing.
Class Method Details
.init_logging(options) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/puppet_editor_services/logging.rb', line 24 def self.init_logging() @log_file = nil if [:debug].nil? @logger = nil elsif ([:debug].casecmp 'stdout').zero? @logger = Logger.new($stdout) elsif ![:debug].to_s.empty? # Log to file begin @log_file = File.open([:debug], 'w') rescue Errno::ENOENT => e # We can't open the log file and we can't log to STDOUT if we're in STDIO mode # So log the error to STDERR and disable logging $stderr.puts "Error opening log file #{[:debug]} : #{e}" # rubocop:disable Style/StderrPuts @log_file = nil return end @log_file.sync = true @logger = Logger.new(@log_file) end end |
.log_message(severity, message) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/puppet_editor_services/logging.rb', line 4 def self.(severity, ) return if @logger.nil? case severity when :debug @logger.debug() when :info @logger.info() when :warn @logger.warn() when :error @logger.error() when :fatal @logger.fatal() else @logger.unknown() end @log_file.fsync unless @log_file.nil? end |
.version ⇒ String
Returns containing the editor services version, e.g. “0.4.0”.
9 10 11 12 13 14 15 16 |
# File 'lib/puppet_editor_services/version.rb', line 9 def self.version return @editor_services_version if @editor_services_version version_file = File.join(File.dirname(__FILE__), 'VERSION') version = read_version_file(version_file) @editor_services_version = version.nil? ? PUPPETEDITORSERVICESVERSION : version end |
.version=(version) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Sets the editor services version Typically only used in testing
24 25 26 |
# File 'lib/puppet_editor_services/version.rb', line 24 def self.version=(version) @editor_services_version = version end |