class Analogger::Client

Overview

Swift::Analogger::Client is the client library for writing logging messages to the Swift Analogger asynchronous logging server.

To use the Analogger client, instantiate an instance of the Client class.

logger = Swift::Analogger::Client.new(:myapplog,'127.0.0.1',12345)

Four arguments are accepted when a new Client is created. The first is the name of the logging facility that this Client will write to. The second is the hostname where the Analogger process is running, and the third is the port number that it is listening on for connections.

The fourth argument is optional. Analogger can require an authentication key before it will allow logging clients to use its facilities. If the Analogger that one is connecting to requires an authentication key, it must be passed to the new() call as the fourth argument. If the key is incorrect, the connection will be closed.

If a Client connects to the Analogger using a facility that is undefined in the Analogger, the log messages will still be accepted, but they will be dumped to the default logging destination.

Once connected, the Client is ready to deliver messages to the Analogger. To send a messagine, the log() method is used:

logger.log(:debug,"The logging client is now connected.")

The log() method takes two arguments. The first is the severity of the message, and the second is the message itself. The default Analogger severity levels are the same as in the standard Ruby

Defined in:

analogger/client.cr
analogger/client/version.cr

Constant Summary

CONNECTION_FAILURE_TIMEOUT = 86400 * 2
MAX_FAILURE_COUNT = 0_u128 &- 1
MAX_LENGTH_BYTES = MAX_MESSAGE_LENGTH.to_s.length
MAX_MESSAGE_LENGTH = 8192
PERSISTENT_QUEUE_LIMIT = 10737412742_i64
RECONNECT_THROTTLE_INTERVAL = 0.1
VERSION = "0.1.0"

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(service : String = "default", host : String = "127.0.0.1", port : Int32 = 6766, key : String = "") #

[View source]

Class Method Detail

def self.connection_failure_timeout #

[View source]
def self.connection_failure_timeout=(val) #

[View source]
def self.max_failure_count #

[View source]
def self.max_failure_count=(val) #

[View source]
def self.persistent_queue_limit #

[View source]
def self.persistent_queue_limit=(val) #

[View source]
def self.reconnect_throttle_interval #

[View source]
def self.reconnect_throttle_interval=(val) #

[View source]

Instance Method Detail

def _drain_the_swamp #

[View source]
def _local_log(service, severity, message) #

[View source]
def _remote_log(service, severity, message, flush_after_send = true) #

[View source]
def authenticate #

[View source]
def authenticated? : Bool #

[View source]
def clear_failure #

[View source]
def close #

[View source]
def close_connection #

[View source]
def closed? #

[View source]
def connect #

[View source]
def connection_failure_timeout : Int32 #

[View source]
def connection_failure_timeout=(val) #

[View source]
def drain_the_swamp #

[View source]
def fail_connect? #

[View source]
def failed? #

[View source]
def failed_too_long? #

[View source]
def failed_too_many? #

[View source]
def log(severity, msg) #

[View source]
def max_failure_count : UInt128 #

[View source]
def max_failure_count=(val) #

[View source]
def non_blocking_lock_on_file_handle(file_handle, &) #

[View source]
def open_connection(host, port) #

[View source]
def persistent_queue_limit : Int64 #

[View source]
def persistent_queue_limit=(val) #

[View source]
def ram_queue_limit #

[View source]
def ram_queue_limit=(val) #

[View source]
def read #

Read a message from the wire using a length header before the msgpack payload.


[View source]
def reconnect #

[View source]
def reconnect_throttle_interval #

[View source]
def reconnect_throttle_interval=(val) #

[View source]
def register_failure #

[View source]
def setup_local_logging #

[View source]
def setup_reconnect_fiber #

[View source]
def setup_remote_logging #

[View source]
def there_is_a_swamp? #

[View source]
def tmplog #

[View source]
def tmplog=(tmplog : Nil | String) #

[View source]
def tmplog_prefix #

[View source]
def tmplogs #

[View source]
def total_count : Int32 #

[View source]