Class: Standard::Lsp::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/standard/lsp/logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(prefix: "[server]") ⇒ Logger

Returns a new instance of Logger.



4
5
6
7
# File 'lib/standard/lsp/logger.rb', line 4

def initialize(prefix: "[server]")
  @prefix = prefix
  @puts_onces = []
end

Instance Method Details

#puts(message) ⇒ Object



9
10
11
# File 'lib/standard/lsp/logger.rb', line 9

def puts(message)
  warn [@prefix, message].compact.join(" ")
end

#puts_once(message) ⇒ Object



13
14
15
16
17
# File 'lib/standard/lsp/logger.rb', line 13

def puts_once(message)
  return if @puts_onces.include?(message)
  @puts_onces << message
  puts(message)
end