Skip to content

Commit

Permalink
add Lamian.config.max_log_lines
Browse files Browse the repository at this point in the history
  • Loading branch information
tycooon committed Jun 28, 2024
1 parent 861ecf2 commit 0e7803d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# Lamian version changes (since 0.1.0)
## 1.9.0

Update this on a pull request, under `Lamian::VERSION`
(also known as next version). If this constant would be changed without release,
I'll update it here too
* Add `max_log_lines` config option to limit number of most recent log lines stored in the log device

## 1.8.0

* Minor dependency updates;

## 1.3.0

* Add support for the (new sentry gem)[https://github.com/getsentry/sentry-ruby].

## 1.2.0

* Add `raven_log_size_limit` config option for limiting amount of data sent to sentry (defaults to `500_000`)

## 1.1.0

* Add support for sentry and sidekiq

## 1.0.0
Expand All @@ -30,29 +32,27 @@ which ruins concept of single entry point :(. Also tied it to lamian instance

* `e57e6cec` Changed rails dependency from `~> 4.2` to `>= 4.2`


## 0.3.1

* 34ca83b5 Fixed formatting

Stabilized formatting api, which removes control sequences from loggers data.
E.g. `"[23mNice, lol[0m\n"` becomes `"Nice, lol\n"`


## 0.3.0

* `d24f895b` API update

Updated API, so lamian is now forced to be used with block.
It also simplified usage outside a middleware


## 0.2.0

* `3166517e` Added integrtation with rails

Injected middleware before `ExceptionNotification`, so `ExceptionNotification`
can use current log without any configuration. Also added some views


## 0.1.0

* `62eb8685` Made test version to check it's integration with rails application
2 changes: 1 addition & 1 deletion lib/lamian/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Lamian
# @attr formatter [Logger::Foramtter]
# formatter to use in lamian, global
# @attr max_log_lines [Integer]
# max number of log lines to log, defaults to 5000
# max number of most recent log lines to store, defaults to 5000
# @attr raven_log_size_limit [Integer]
# size limit when sending lamian log to sentry, defaults to +500_000+
Config = Struct.new(:formatter, :max_log_lines, :raven_log_size_limit) do
Expand Down
8 changes: 4 additions & 4 deletions spec/lamian/log_device_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# frozen_string_literal: true

describe Lamian::LogDevice do
subject(:logdev) { described_class.new(10) }
subject(:logdev) { described_class.new(5) }

it "saves log" do
logdev.write("Hello ")
logdev.write("world!")
expect(logdev.string).to eq("Hello world!")
end

it "limits log lines" do
15.times { logdev.write("hello") }
expect(logdev.string.scan(/hello/).size).to eq(10)
it "only stores 5 latest log lines" do
8.times { |x| logdev.write(x + 1) }
expect(logdev.string).to eq("45678")
end
end

0 comments on commit 0e7803d

Please sign in to comment.