Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stackify-ruby-logging

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stackify-ruby-logging

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

stackify-ruby-logging

Logging handler for sending log messages and exceptions to Stackify. Logging >=2.0.0 <2.2.2 is supported.

Installation

Add this line to your application's Gemfile:

gem 'logging'
gem 'stackify-ruby-logging'

And then execute:

$ bundle install

Note

This stackify-ruby-logging gem will work and tested for the following Ruby versions: 2.1.x, 2.3.x, 2.4.x, 2.5.x
However this gem won't work in ruby version such as 1.9.x/2.0.x.

Usage

Rails

If your application is based on Rails you will add the script below in config/application.rb. For example:

module SampleRailsApp
  class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 5.2
    ...
    Other code goes here...
    ...
    require 'logging'
    Logging.init

    logger = Logging.logger['sample_logger']
    logger = Stackify::LoggerProxy.new(logger)
    logger.add_appenders \
      Logging.appenders.stdout,   # output log messages to stdout, you can remove this line if you don't want to display to stdout
      Logging.appenders.file(File.join('log', 'development.log')), # output log messages to a log file
      Logging.appenders.stackify(                                  # output log messages to Stackify
        :api_key => '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ',
        :app_name => 'rails-app',
        :environment => :development,
        :log_level => :info
      )
    config.logger = logger
  end
end

Non-Rails

For using stackify-ruby-logging gem within any Ruby application such as Sinatra add to top of your main file:

require 'logging'
Logging.init

logger = Logging.logger['sample_logger']
logger = Stackify::LoggerProxy.new(logger)
logger.add_appenders \
  Logging.appenders.stdout,
  Logging.appenders.file(File.join('log', 'development.log')),
  Logging.appenders.stackify(
    :api_key => '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ',
    :app_name => 'sinatra-app',
    :environment => :development,
    :log_level => :info
  )

Log level

You can use the following log levels: :info, :debug, :warn, :error & :fatal.

Troubleshooting

If there are problems, you can enable internal logging of the stackify-ruby-logging. Add debug_log option see the example below:

require 'logging'
Logging.init

logger = Logging.logger['sample_logger']
logger = Stackify::LoggerProxy.new(logger)
logger.add_appenders \
  Logging.appenders.stdout,
  Logging.appenders.file(File.join('log', 'development.log')),
  Logging.appenders.stackify(
    :api_key => '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ',
    :app_name => 'sinatra-app',
    :environment => :development,
    :log_level => :info,
    :debug_log => File.join('log', 'stackify.log')
  )

FAQs

Package last updated on 15 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc