Coder Social home page Coder Social logo

vectordotdev / timber-ruby Goto Github PK

View Code? Open in Web Editor NEW
154.0 7.0 19.0 953 KB

๐ŸŒฒ Great Ruby logging made easy.

Home Page: https://timber.io

License: Other

Ruby 100.00%
timber timber-ruby structured-logging log logging ruby rails sinatra metadata contextual-data

timber-ruby's Introduction

๐ŸŒฒ Timber - Great Ruby Logging Made Easy


ISC License Yard Docs Build Status Code Climate

Timber.io is a hosted service for aggregating logs across your entire stack - any language, any platform, any data source.

Unlike traditional logging tools, Timber integrates with language runtimes to automatically capture in-app context, turning your text-based logs into rich structured events. Timber integrates with Ruby through this library. And Timber's rich free-form query tools and real-time tailing, make drilling down into important stats easier than ever.


Features

  • Simple integration. Exposes the same API as the Ruby Logger.
  • Performant, light-weight, and thoughtful design.
  • Support for structured logging.
  • Support for context.
  • Automatic context capturing.
  • Integrates with popular 3rd party libraries, such as Rails and Rack.

Get Started


Timber โ€ข Docs โ€ข Pricing โ€ข Security โ€ข Compliance

timber-ruby's People

Contributors

austenito avatar binarylogic avatar bjeanes avatar bsharpe avatar mitchellhenke avatar piotrj avatar soulim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

timber-ruby's Issues

Release gem

Currently in alpha testing and am not bothering with a gem to reduce the iteration cycle.

Error in staging and no more logs are shown

Hi I am getting this error in the Timber console and no more logs are shown:

Could not log "start_processing.action_controller" event. NameError: uninitialized constant Timber::Events::ControllerCall::SANITIZED_VALUE

followed by a long traceback

This does not happen in production, only in staging.
To differentiate between the 2, I am using an environment variable:

production.rb

  # Install the Timber.io logger, send logs over HTTP
  log_device = Timber::LogDevices::HTTP.new(ENV["TIMBER_API_KEY"])
  logger = Timber::Logger.new(log_device)
  logger.level = config.log_level
  config.logger = ActiveSupport::TaggedLogging.new(logger)

Rails 5.0.2 EC2 Ubuntu 16.04

Scrub sensitive parameters

Rails provides this, but we grab parameters within a rack middleware. We need to ensure that params are scrubbed and also provide options to add additional parameters (this should fallback to the rails settings).

Option to write JSON ecoded lines to a log

Advanced users might want to forgo the built in log transport strategy and write their logs to an intermediary destination where an agent will tail and send the logs to our API. A good example is the heroku log drains. It is more efficient to write the JSON payload to STDOUT and have heroku handle the transport.

Nil Error: "undefined method `encoding' for nil:NilClass"

Rails 4.0.13
Timber 2.0.14

undefined method `encoding' for nil:NilClass

Stack trace that relates to timber

/gems/timber-2.0.14/lib/timber/util/string.rb:9 in normalize_to_utf8
/gems/timber-2.0.14/lib/timber/util/http_event.rb:31 in block in normalize_headers
/gems/timber-2.0.14/lib/timber/util/http_event.rb:27 in each
/gems/timber-2.0.14/lib/timber/util/http_event.rb:27 in each_with_object
/gems/timber-2.0.14/lib/timber/util/http_event.rb:27 in normalize_headers
/gems/timber-2.0.14/lib/timber/events/http_server_request.rb:13 in initialize
/gems/timber-2.0.14/lib/timber/integrations/rack/http_events.rb:15 in new
/gems/timber-2.0.14/lib/timber/integrations/rack/http_events.rb:15 in block in call
/usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/logger.rb:372 in add
/gems/timber-2.0.14/lib/timber/logger.rb:232 in info
/gems/timber-2.0.14/lib/timber/integrations/rack/http_events.rb:14 in call
/gems/timber-2.0.14/lib/timber/integrations/rack/user_context.rb:21 in call
/gems/timber-2.0.14/lib/timber/integrations/rack/session_context.rb:18 in call
/gems/timber-2.0.14/lib/timber/integrations/rack/http_context.rb:19 in block in call
/gems/timber-2.0.14/lib/timber/current_context.rb:65 in with
/gems/timber-2.0.14/lib/timber/current_context.rb:18 in with
/gems/timber-2.0.14/lib/timber/integrations/rack/http_context.rb:18 in call

Add option to capture context if no log lines were written

In certain circumstances a context will be set but a log line will not be written. We should allow a safety / default log line to be written so that it gets sent to the Timber API. The ensures context data does not get lost if this is desired.

Change `Logger` method signature to support options

The ruby Logger currently takes one parameter for it's info, warn, etc methods. As a result, of our "no risk of lock-in" policy, it requires us to do:

Logger.info(message: "My message", data: "value")

People will absolutely forget to do that because they are not used to logging hashes of that manner. I propose we allow:

Logger.info("My message", data: "value")

This requires us to change the default Logger method signatures, but it's so much more user friendly.

Add option to log and trace network requests

Adding network request details to the logs provides insight into service interaction. If this is performed within a http request we should carry over the request_id so that this can be traced.

Capture log tags

For ActiveSupport::TaggedLogger we should capture the log tags.

Consider a simple log instantiator

Rails is a little nuts with it's Logger classes. Example:

config.logger = ::ActiveSupport::TaggedLogging.new(::ActiveSupport::Logger.new(Timber::LogDevices::HerokuLogplex.new))
  1. ActiveSupport::TaggedLogging is only in >= 3.2
  2. ActiveSupport::Logger is only in >= 3.2

We'll get support tickets saying it doesn't work for older rails versions. We could do:

Timber::Logger.default(Timber::LogDevices::HerokuLogplex.new)

Where all of this class checking is done within that method.

Document code

Finish documenting code and throw it on a docs site. Most likely rdoc.info.

Document custom contexts

We need to ensure setting custom contexts is easy and document it well. This should map to dynamic fields within the API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.