Module: Lamian
- Defined in:
- lib/lamian.rb,
lib/lamian/config.rb,
lib/lamian/engine.rb,
lib/lamian/logger.rb,
lib/lamian/version.rb,
lib/lamian/middleware.rb,
lib/lamian/logger_extension.rb,
lib/lamian/semantic_logger_appender.rb
Overview
Lamian is an in-memory logger, which content could be released for error messages. It is designed to work in pair with ‘exception_notification` gem inside rails aplications
Defined Under Namespace
Modules: LoggerExtension, RavenContextExtension Classes: Config, Engine, Logger, Middleware, SemanticLoggerAppender, SidekiqRavenMiddleware, SidekiqSentryMiddleware
Constant Summary collapse
- SENTRY_EXTRA_KEY =
The key under which logs are stored in the Sentry extra data.
:lamian_log- VERSION =
Current lamian vewrsion
format: ‘a.b.c’ with possible suffixes such as alpha
-
a is for major version, it is guaranteed to be changed if back-compatibility of public API is broken
-
b is for minor version, it is guaranteed to be changed on public API changes and also if private API back-compatibility is broken
-
c is for incremental version, it is updated in other cases
According to this, it is enought to specify ‘~> a.b’ if private API was not used and to specify ‘~> a.b.c’ if it was
-
"1.4.0"
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Lamian::Config
(also: config)
Yields curent configuration if block given.
-
.dump(format: nil) ⇒ Object
Dumps log collected in this run.
-
.dump_limited ⇒ String?
Truncates the collected log to the specified limit and dumps it.
-
.extend_logger(other_logger) ⇒ Object
Extends logger instance to tee it’s output to Lamian logger.
-
.logger ⇒ Lamian::Logger
private
Gives access to current logger.
-
.run(&block) ⇒ Object
Collects logs sent inside block.
Class Method Details
.configure {|config| ... } ⇒ Lamian::Config Also known as: config
Yields curent configuration if block given
32 33 34 35 36 |
# File 'lib/lamian.rb', line 32 def configure @config ||= Config.new yield(@config) if block_given? @config end |
.dump(format: nil) ⇒ Object
Dumps log collected in this run
63 64 65 |
# File 'lib/lamian.rb', line 63 def dump(format: nil) logger.dump(format: format) end |
.dump_limited ⇒ String?
Truncates the collected log to the specified limit and dumps it.
69 70 71 |
# File 'lib/lamian.rb', line 69 def dump_limited dump(format: :txt)&.slice(0, Lamian.config.raven_log_size_limit) end |
.extend_logger(other_logger) ⇒ Object
Extends logger instance to tee it’s output to Lamian logger
41 42 43 |
# File 'lib/lamian.rb', line 41 def extend_logger(other_logger) other_logger.extend(Lamian::LoggerExtension) end |
.logger ⇒ Lamian::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.
Gives access to current logger
48 49 50 |
# File 'lib/lamian.rb', line 48 def logger Lamian::Logger.current end |
.run(&block) ⇒ Object
Collects logs sent inside block
53 54 55 |
# File 'lib/lamian.rb', line 53 def run(&block) logger.run(&block) end |