slack_webhook_logger 0.5.2 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +13 -3
- data/CHANGELOG.md +4 -0
- data/lib/slack_webhook_logger/formatter.rb +8 -3
- data/lib/slack_webhook_logger/request_io.rb +2 -2
- data/lib/slack_webhook_logger/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 96e88ffe219e928ae89d442a038315b73e4fa4b57134f426aef3e5b62e5b807e
|
|
4
|
+
data.tar.gz: ed1a29838a186cd9cf488ccdc0d45c89f964d17385c1884079d4ea1aa9d512be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b969a4ec3c7d972803877749e74732707ecf9dc997e66bde91b4f168e0e8a0371d86fcf91468a35e5f74ddcbe7a9d7bb56130c112af329684328fdc67781c32
|
|
7
|
+
data.tar.gz: e2a3a168dd998f9cce18dd91d34d10274b78b8dc0b47773c2ae7b2df75f1df40dca8918b09162a545565b2462300ec3818a43fc0aee541d40ea70c0516dfe674
|
data/.github/dependabot.yml
CHANGED
|
@@ -3,15 +3,25 @@ updates:
|
|
|
3
3
|
- package-ecosystem: "github-actions"
|
|
4
4
|
directory: "/"
|
|
5
5
|
schedule:
|
|
6
|
-
interval:
|
|
6
|
+
interval: weekly
|
|
7
|
+
day: monday
|
|
7
8
|
time: "09:00"
|
|
8
9
|
timezone: "Etc/UTC"
|
|
10
|
+
groups:
|
|
11
|
+
github-actions:
|
|
12
|
+
patterns:
|
|
13
|
+
- "*"
|
|
9
14
|
open-pull-requests-limit: 10
|
|
10
15
|
|
|
11
|
-
- package-ecosystem:
|
|
16
|
+
- package-ecosystem: bundler
|
|
12
17
|
directory: "/"
|
|
13
18
|
schedule:
|
|
14
|
-
interval:
|
|
19
|
+
interval: weekly
|
|
20
|
+
day: monday
|
|
15
21
|
time: "09:00"
|
|
16
22
|
timezone: "Etc/UTC"
|
|
17
23
|
open-pull-requests-limit: 10
|
|
24
|
+
groups:
|
|
25
|
+
bundler-dependencies:
|
|
26
|
+
patterns:
|
|
27
|
+
- "*"
|
data/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,13 @@ module SlackWebhookLogger
|
|
|
4
4
|
class Formatter < ::Logger::Formatter
|
|
5
5
|
attr_writer :format
|
|
6
6
|
|
|
7
|
-
MAX_LENGTH =
|
|
7
|
+
MAX_LENGTH = 3000
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
def fetch_text(hash)
|
|
11
|
+
hash[:blocks].last[:text][:text]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
8
14
|
|
|
9
15
|
def format
|
|
10
16
|
@format ||= proc do |severity, time, _progname, msg|
|
|
@@ -39,7 +45,6 @@ module SlackWebhookLogger
|
|
|
39
45
|
|
|
40
46
|
def slackify(title, text)
|
|
41
47
|
{
|
|
42
|
-
text: [title, text].join("\n").to_s,
|
|
43
48
|
blocks: [
|
|
44
49
|
{
|
|
45
50
|
type: "section",
|
|
@@ -75,7 +80,7 @@ module SlackWebhookLogger
|
|
|
75
80
|
end
|
|
76
81
|
|
|
77
82
|
private def truncate(string)
|
|
78
|
-
string.length > MAX_LENGTH ? "#{string[0...MAX_LENGTH]}..." : string
|
|
83
|
+
string.length > MAX_LENGTH ? "#{string[0...MAX_LENGTH - 3]}..." : string
|
|
79
84
|
end
|
|
80
85
|
end
|
|
81
86
|
end
|
|
@@ -14,9 +14,9 @@ module SlackWebhookLogger
|
|
|
14
14
|
def write(hash)
|
|
15
15
|
return if hash.blank?
|
|
16
16
|
|
|
17
|
-
return if SlackWebhookLogger.ignore_patterns.any? { |ignore_pattern| hash
|
|
17
|
+
return if SlackWebhookLogger.ignore_patterns.any? { |ignore_pattern| SlackWebhookLogger::Formatter.fetch_text(hash).match(ignore_pattern) }
|
|
18
18
|
|
|
19
|
-
response = HTTPX.with(headers: { "content-type" => "application/json" }).post(SlackWebhookLogger.webhook_uri.to_s,
|
|
19
|
+
response = HTTPX.with(headers: { "content-type" => "application/json" }).post(SlackWebhookLogger.webhook_uri.to_s, json: hash)
|
|
20
20
|
|
|
21
21
|
return if (200..299).cover?(response.status)
|
|
22
22
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slack_webhook_logger
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Garen J. Torikian
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-08-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
120
120
|
- !ruby/object:Gem::Version
|
|
121
121
|
version: '0'
|
|
122
122
|
requirements: []
|
|
123
|
-
rubygems_version: 3.4.
|
|
123
|
+
rubygems_version: 3.4.18
|
|
124
124
|
signing_key:
|
|
125
125
|
specification_version: 4
|
|
126
126
|
summary: A slim wrapper for posting to Rails logs to Slack
|