class SemanticLogger::Appender::MongoDB
def initialize(uri:,
Name of this application to appear in log messages.
application: [String]
Default: SemanticLogger.host
Name of this host to appear in log messages.
host: [String]
The Proc must return true or false.
Proc: Only include log messages where the supplied Proc returns true
regular expression. All other messages will be ignored.
RegExp: Only include log messages where the class name matches the supplied.
filter: [Regexp|Proc]
Default: Use the built-in formatter (See: #call)
the output from this appender
An instance of a class that implements #call, or a Proc to be used to format
formatter: [Object|Proc|Symbol]
Default: SemanticLogger.default_level
Override the log level for this appender.
level: [:trace | :debug | :info | :warn | :error | :fatal]
Default: no max limit
Maximum number of log entries that the capped collection will hold.
collection_max: [Integer]
Release: 4GB
Test: File
Dev: .5GB
Prod: 25GB (.5GB per day across 4 servers over 10 days)
Examples:
Default: 1 GB
The size of the MongoDB capped collection to create in bytes
collection_size: [Integer]
Default: 0
see: http://docs.mongodb.org/manual/reference/write-concern/
Write concern to use
write_concern: [Integer]
Default: semantic_logger
Name of the collection to store log data in
collection_name: [String]
mongodb://127.0.0.1:27017/test
Example:
Mongo connection string.
uri: [String]
Parameters:
Create a MongoDB Appender instance
def initialize(uri:, collection_name: "semantic_logger", write_concern: 0, collection_size: 1024**3, collection_max: nil, **args, &block) @client = Mongo::Client.new(uri, logger: logger) @collection_name = collection_name @options = { capped: true, size: collection_size, write: {w: write_concern} } @options[:max] = collection_max if collection_max reopen # Create the collection and necessary indexes create_indexes super(**args, &block) end