Module: Smplkit
- Defined in:
- lib/smplkit.rb,
lib/smplkit/ws.rb,
lib/smplkit/debug.rb,
lib/smplkit/client.rb,
lib/smplkit/errors.rb,
lib/smplkit/context.rb,
lib/smplkit/helpers.rb,
lib/smplkit/metrics.rb,
lib/smplkit/railtie.rb,
lib/smplkit/version.rb,
lib/smplkit/log_level.rb,
lib/smplkit/flags/types.rb,
lib/smplkit/flags/client.rb,
lib/smplkit/flags/models.rb,
lib/smplkit/config/client.rb,
lib/smplkit/config/models.rb,
lib/smplkit/flags/helpers.rb,
lib/smplkit/config/helpers.rb,
lib/smplkit/logging/client.rb,
lib/smplkit/logging/levels.rb,
lib/smplkit/logging/models.rb,
lib/smplkit/logging/helpers.rb,
lib/smplkit/logging/sources.rb,
lib/smplkit/management/types.rb,
lib/smplkit/config_resolution.rb,
lib/smplkit/logging/normalize.rb,
lib/smplkit/management/buffer.rb,
lib/smplkit/management/client.rb,
lib/smplkit/management/models.rb,
lib/smplkit/logging/adapters/base.rb,
lib/smplkit/generators/install_generator.rb,
lib/smplkit/logging/adapters/stdlib_logger_adapter.rb,
lib/smplkit/logging/adapters/semantic_logger_adapter.rb
Overview
Defined Under Namespace
Modules: Config, ConfigResolution, Debug, Errors, Flags, Generators, Helpers, Logging, Management, Op, RequestContext Classes: ApiErrorDetail, Client, ConflictError, ConnectionError, Context, ContextScope, Error, FlagDeclaration, LogLevel, ManagementClient, MetricsReporter, NotFoundError, Railtie, Rule, SharedWebSocket, TimeoutError, ValidationError
Constant Summary collapse
- VERSION =
"0.0.0"- FlagValue =
Top-level re-exports for convenience.
Flags::FlagValue
- FlagRule =
Flags::FlagRule
- FlagEnvironment =
Flags::FlagEnvironment
- ConfigItem =
Top-level re-exports.
Config::ConfigItem
- ConfigEnvironment =
Config::ConfigEnvironment
- ItemType =
Config::ItemType
- LoggerSource =
Top-level re-export.
Logging::LoggerSource
- Color =
Management::Color
- EnvironmentClassification =
Management::EnvironmentClassification
- LoggingAdapter =
Top-level re-export.
Logging::Adapters::Base
- StdlibLoggerAdapter =
Logging::Adapters::StdlibLoggerAdapter
Class Attribute Summary collapse
-
.client ⇒ Object
Returns the value of attribute client.
-
.context_provider ⇒ Object
Returns the value of attribute context_provider.
Class Method Summary collapse
-
.configure_for_rails(options) ⇒ Object
Construct the global
Smplkit.clientfrom a Rails-friendly options struct. - .debug(subsystem, message) ⇒ Object
- .enable_debug ⇒ Object
- .request_context ⇒ Object
- .set_request_context(contexts) ⇒ Object
Class Attribute Details
.client ⇒ Object
Returns the value of attribute client.
46 47 48 |
# File 'lib/smplkit/railtie.rb', line 46 def client @client end |
.context_provider ⇒ Object
Returns the value of attribute context_provider.
46 47 48 |
# File 'lib/smplkit/railtie.rb', line 46 def context_provider @context_provider end |
Class Method Details
.configure_for_rails(options) ⇒ Object
Construct the global Smplkit.client from a Rails-friendly options struct. Falls back to SMPLKIT_* env vars + ~/.smplkit resolution for any field the customer left blank.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/smplkit/railtie.rb', line 29 def configure_for_rails() client = Client.new( api_key: .api_key, environment: .environment || (defined?(::Rails) ? ::Rails.env : nil), service: .service, profile: .profile, base_domain: .base_domain, scheme: .scheme, debug: .debug, telemetry: .telemetry ) @client = client @context_provider = .context_provider client end |
.debug(subsystem, message) ⇒ Object
43 44 45 |
# File 'lib/smplkit/debug.rb', line 43 def debug(subsystem, ) Debug.emit(subsystem, ) end |
.enable_debug ⇒ Object
47 48 49 |
# File 'lib/smplkit/debug.rb', line 47 def enable_debug Debug.enable! end |
.request_context ⇒ Object
65 66 67 |
# File 'lib/smplkit/context.rb', line 65 def request_context RequestContext.get end |
.set_request_context(contexts) ⇒ Object
60 61 62 63 |
# File 'lib/smplkit/context.rb', line 60 def set_request_context(contexts) previous = RequestContext.set(contexts) ContextScope.new(previous) end |