1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

24 Commits

Author SHA1 Message Date
0a011efc32 Don't rely on nil being frozen in tests
Turns out, in JRuby 9.1, nil is not frozen. In all other supported
Rubies, `nil.frozen?` is true.
2017-02-02 17:55:55 +01:00
7bc351faae Parse Time in tests with a numeric offset
Ruby's Time parser doesn't know named timezones and ignores them. By
specifying the actual offset, we get a valid time object.
2017-02-02 17:43:42 +01:00
407b52120a Add basic fields to hold additional data on Buffers
The fields follow the basic structure of basic Hashes and Arrays but
provide an interface better suitable for us. Specifically:

* They check and enforce the datatypes for keys and values to be
  strictly JSON-conforming. Only the basic data-types are accepted
  respectively converted to.
* Hashes only accept String keys.
* Basic values are always frozen.
2017-02-02 15:04:02 +01:00
8768630dbb Drop the default :each on before blocks in rspec 2017-02-02 00:23:31 +01:00
0465b11344 Improve code formatting of specs 2017-01-29 16:44:54 +01:00
faeddf8039 Replace usage of alias_method with alias in class body 2017-01-29 16:43:40 +01:00
5d1890bb5b Add to_json method to messages, don't freeze it anymore 2017-01-29 16:15:44 +01:00
52268c2a35 Use more compact rspec output by default. Also show Ruby's warnings 2017-01-27 14:49:01 +01:00
ee9feaa081 Resolve warning about ambiguous argument in logger spec 2017-01-27 14:42:37 +01:00
4204762c6c Don't die when trying to dup a singleton unfrozen object 2017-01-26 23:32:29 +01:00
d192db441a Retain the original message in a Message object
We only format and convert it after passing it through the formatter.
That way, we can ensure that the actually interesting formatted value
is valid.
2017-01-26 23:32:29 +01:00
2261315dcc Use a class instance for Message's default formatter
Calling #call in a custom class instead of a lambda performs much
better:

    require 'benchmark/ips'

    class RawFormatter
      def call(_severity, _timestamp, _progname, msg) msg end
    end

    Benchmark.ips do |x|
      message = 'my message'

      proc = ->(_severity, _timestamp, _progname, msg) { msg }
      instance = RawFormatter.new

      x.report('proc') do
        proc.call(nil, nil, nil, message)
      end

      x.report('instance') do
        instance.call(nil, nil, nil, message)
      end

      x.compare!
    end

    # Warming up --------------------------------------
    #                 proc   159.882k i/100ms
    #             instance   182.648k i/100ms
    # Calculating -------------------------------------
    #                 proc      4.612M (± 5.2%) i/s -     23.023M in   5.005950s
    #             instance      7.716M (± 6.3%) i/s -     38.539M in   5.015306s
    #
    # Comparison:
    #             instance:  7716097.7 i/s
    #                 proc:  4611920.5 i/s - 1.67x  slower
2017-01-25 23:35:28 +01:00
2b72a1e5cf Actually freeze messages after initialization 2017-01-25 18:58:06 +01:00
1fc6a93ce5 Use gem install bundler on Travis CI for jruby-head
This is required since bundler support seems to be broken right now on
the default "image" of jruby-head on Travis. If we install it explicitly
(or update it to the latest version on all other Rubies), we will be
fine though.
2017-01-19 00:05:16 +01:00
acdeeae237 Add shortcut log methods to Rackstash::Logger
Using methods named after the severity, users can esily log messages
based on their intended severity. We do support the block syntax
throughout to conditionally log expensive messages only if the log level
is low enough:

    logger.debug { compute_details_for_log }
2017-01-18 23:58:17 +01:00
3081b03db1 Add basic logger structure with early spikes
The Rackstash::Logger class will server as the public main entry point
for users. It will eventually implement the mostly complete interface of
Ruby's Logger.

The idea of Rackstash is the we will allow to buffer multiple log
messages allong with additional data until a combined log event is
eventually flushed to an underlying log target. This allows to keep
connected log messages and data as a single unit from the start without
having to painstakingly parse and connect these in later systems again.
2017-01-18 23:34:55 +01:00
a6f41e4bf1 Test on all supported versions of MRI Ruby and JRuby.
We wnumerate exact Ruby versions in .travis.yml. This is required for
at least Ruby 2.4 which isn't currently recognized as a fuzzy match in
Travis' RVM version. When specifying it as an exact version, it will
install it though.

We specify all the other versions too since this makes our tests more
reproducable over time.
2017-01-16 00:28:06 +01:00
8ddb0fc127 Require at least Ruby 2.1 2017-01-16 00:28:06 +01:00
8777596de4 Bump version to 0.2.0-dev
Since this is a complete rewrite of the original rackstash gem which got
up to v0.1, we start directly on 0.2 with our development and will
eventually release it as v0.2.
2017-01-16 00:28:06 +01:00
5dc6af0220 Add more useful version specification. 2017-01-16 00:28:06 +01:00
572b95c580 Use single-quotes and check line-length to 80 chars 2017-01-15 18:49:43 +01:00
063f2fc53f Add basic information to the gemspec 2017-01-15 18:47:46 +01:00
750da262b7 Add license headers to all code files 2017-01-15 18:38:33 +01:00
7e937904c0 Create inititial gem structure for rackstash
bundle gem --exe --coc --mit --test=rspec rackstash
2017-01-15 18:38:33 +01:00