Class: RedisStreamLogger::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/redis_stream_logger/config.rb

Overview

Config provides configuration options for the log device. buffer_size: Max number of items to hold in queue before attempting to write a batch defaults to 100 send_interval: Number of seconds to wait before sending the buffer, despite buffer_size defaults to 10 connection: Redis connection to use for logger batch_size: Number of of log items to send to Redis at a time defaults to buffer_size stream_name: Stream to publish messages to max_len: Maximum size of stream. Ideally you will have a log consumer set up that calls xtrim after persisting your logs somewhere. If that’s more than you need, and just want a simple way to cap the log size set max_len to some sufficiently large number to keep your logs around long enough to be useful.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



21
22
23
24
25
26
27
28
29
# File 'lib/redis_stream_logger/config.rb', line 21

def initialize
  @buffer_size = 100
  @send_interval = 10
  @connection = nil
  @batch_size = @buffer_size
  @stream_name = nil
  @max_len = nil
  @log_set_key = "log-streams"
end

Instance Attribute Details

#batch_sizeObject

Returns the value of attribute batch_size.



19
20
21
# File 'lib/redis_stream_logger/config.rb', line 19

def batch_size
  @batch_size
end

#buffer_sizeObject

Returns the value of attribute buffer_size.



19
20
21
# File 'lib/redis_stream_logger/config.rb', line 19

def buffer_size
  @buffer_size
end

#connectionObject

Returns the value of attribute connection.



19
20
21
# File 'lib/redis_stream_logger/config.rb', line 19

def connection
  @connection
end

#log_set_keyObject

Returns the value of attribute log_set_key.



19
20
21
# File 'lib/redis_stream_logger/config.rb', line 19

def log_set_key
  @log_set_key
end

#max_lenObject

Returns the value of attribute max_len.



19
20
21
# File 'lib/redis_stream_logger/config.rb', line 19

def max_len
  @max_len
end

#send_intervalObject

Returns the value of attribute send_interval.



19
20
21
# File 'lib/redis_stream_logger/config.rb', line 19

def send_interval
  @send_interval
end

#stream_nameObject

Returns the value of attribute stream_name.



19
20
21
# File 'lib/redis_stream_logger/config.rb', line 19

def stream_name
  @stream_name
end