Class: Cequel::Metal::Logger Private
- Inherits:
-
Object
- Object
- Cequel::Metal::Logger
- Extended by:
- Forwardable
- Defined in:
- lib/cequel/metal/logger.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The Logger class encapsulates logging functionality for Keyspace.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#out ⇒ ::Logger
readonly
private
An instance of Logger from the standard library.
-
#severity ⇒ Integer
readonly
private
The severity level for this logger.
-
#threshold ⇒ Integer
private
Only log queries that take longer than threshold ms.
Instance Method Summary collapse
-
#initialize(out, severity, threshold = 0) ⇒ Logger
constructor
private
A new instance of Logger.
-
#log(label, timing, statement, bind_vars) ⇒ void
private
Log a CQL statement.
Constructor Details
#initialize(out, severity, threshold = 0) ⇒ Logger
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Logger.
23 24 25 |
# File 'lib/cequel/metal/logger.rb', line 23 def initialize(out, severity, threshold = 0) @out, @severity, @threshold = out, severity, threshold end |
Instance Attribute Details
#out ⇒ ::Logger (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns An instance of Logger from the standard library.
11 12 13 |
# File 'lib/cequel/metal/logger.rb', line 11 def out @out end |
#severity ⇒ Integer (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The severity level for this logger.
13 14 15 |
# File 'lib/cequel/metal/logger.rb', line 13 def severity @severity end |
#threshold ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Only log queries that take longer than threshold ms.
15 16 17 |
# File 'lib/cequel/metal/logger.rb', line 15 def threshold @threshold end |
Instance Method Details
#log(label, timing, statement, bind_vars) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Log a CQL statement
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/cequel/metal/logger.rb', line 36 def log(label, timing, statement, bind_vars) if timing >= threshold out.add(severity) do sprintf( '%s (%dms) %s', label, timing, sanitize(statement, bind_vars) ) end end end |