/
config.rb
46 lines (37 loc) · 1.06 KB
/
config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module Bunyan
class Logger
class Config
# used to hold all user-defined configuration options
attr_accessor :collection, :database, :disabled
def initialize
@size = 52428800
@disabled = false
end
def [](meth)
send(meth)
end
# First time called sets the database name.
# Otherwise, returns the database name.
def database(db_name = nil)
@database ||= db_name
end
alias_method :database=, :database
# First time called sets the collection name.
# Otherwise, returns the collection name.
# For the actual collection object returned by Mongo, see #db.
def collection(coll = nil)
@collection ||= coll
end
alias_method :collection=, :collection
def disabled(dis = nil)
@disabled ||= dis
end
alias_method :disabled=, :disabled
# default size is 50 megabytes
def size(new_size = nil)
new_size.nil? ? @size : @size = new_size
end
alias_method :size=, :size
end
end
end