Module: Vox

Defined in:
lib/vox.rb,
lib/vox/version.rb,
lib/vox/http/util.rb,
lib/vox/http/error.rb,
lib/vox/http/route.rb,
lib/vox/http/client.rb,
lib/vox/http/routes.rb,
lib/vox/gateway/client.rb,
lib/vox/http/upload_io.rb,
lib/vox/http/routes/user.rb,
lib/vox/gateway/websocket.rb,
lib/vox/http/routes/emoji.rb,
lib/vox/http/routes/guild.rb,
lib/vox/http/routes/voice.rb,
lib/vox/http/routes/invite.rb,
lib/vox/http/routes/channel.rb,
lib/vox/http/routes/gateway.rb,
lib/vox/http/routes/webhook.rb,
lib/vox/http/routes/audit_log.rb,
lib/vox/http/middleware/rate_limiter.rb,
lib/vox/http/middleware/log_formatter.rb

Overview

Parent module containing all component pieces

Defined Under Namespace

Modules: Gateway, HTTP Classes: Error

Constant Summary collapse

VERSION =

Gem version

'0.2.3'

Class Method Summary collapse

Class Method Details

.setup_default_logger(root_level: :info, **rules) ⇒ Object

Setup default appenders, log level, and formatting scheme.

Examples:

Vox.setup_default_logger(root_level: :warn, Vox::HTTP: :info, Vox::Gateway: :info)

Parameters:

  • root_level (Symbol) (defaults to: :info)

    The default logging level for all ‘Vox` loggers.

  • rules (Hash<Class, Symbol>)

    Custom levels for each desired class.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vox.rb', line 12

def self.setup_default_logger(root_level: :info, **rules)
  Logging.logger[Vox].level = root_level

  rules.each do |log, level|
    Logging.logger[log].level = level
  end

  Logging.color_scheme('vox_default',
                       levels: {
                         debug: :magenta,
                         info: :green,
                         warn: :yellow,
                         error: :red,
                         fatal: %i[white on_red]
                       },
                       date: :blue,
                       logger: :cyan)

  Logging.logger[Vox].add_appenders(
    Logging.appenders.stdout(layout: Logging.layouts.pattern(color_scheme: 'vox_default'))
  )
end