job_enqueue_logger 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +6 -4
- data/lib/job_enqueue_logger/delayed_job_adapter.rb +2 -2
- data/lib/job_enqueue_logger/que_adapter.rb +2 -2
- data/lib/job_enqueue_logger/railtie.rb +1 -0
- data/lib/job_enqueue_logger/resque_adapter.rb +2 -2
- data/lib/job_enqueue_logger/sidekiq_adapter.rb +2 -2
- data/lib/job_enqueue_logger/sucker_punch_adapter.rb +1 -5
- data/lib/job_enqueue_logger/utils.rb +11 -1
- data/lib/job_enqueue_logger/version.rb +1 -1
- data/lib/job_enqueue_logger.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: dea7d0e16e19e83d6a41a6ac12dfb637670b6c2767ffd859a65c33eb1fe6fb1b
|
4
|
+
data.tar.gz: 44da64bbfc0bcc1984dff1bb971768d0ebec961e4eefba46b9223c38115f6376
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b20c92834369550756fe71f0f27c76dca198fe267fad432765740bbcf3a1ed034e89aa126fb2acf6e76978f632813241176af77a7d139762ffd4d7ba9f4c2e5
|
7
|
+
data.tar.gz: e5ef769550740936181d7fa72b78bc6c132542095e0bb66f7c4973bf90298bc6ffed1d168e4aa553f4b60ae8266fc8221dbfa611fc02c1855ffa48a110157592
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -11,13 +11,13 @@ This is very much a development and debugging tool; it is not recommended to use
|
|
11
11
|
When the job is enqueued within the guts of the application, the log line is generated:
|
12
12
|
|
13
13
|
```
|
14
|
-
Enqueued AvatarThumbnailsJob (jid=578b3d10fc5403f97ee0a8e1) to Sidekiq(default) with arguments: 1092412064
|
14
|
+
[JobEnqueueLogger] Enqueued AvatarThumbnailsJob (jid=578b3d10fc5403f97ee0a8e1) to Sidekiq(default) with arguments: 1092412064
|
15
15
|
```
|
16
16
|
|
17
17
|
Or with backtraces enabled:
|
18
18
|
|
19
19
|
```
|
20
|
-
Enqueued AvatarThumbnailsJob (jid=578b3d10fc5403f97ee0a8e1) to Sidekiq(default) with arguments: 1092412064
|
20
|
+
[JobEnqueueLogger] Enqueued AvatarThumbnailsJob (jid=578b3d10fc5403f97ee0a8e1) to Sidekiq(default) with arguments: 1092412064
|
21
21
|
↳ app/models/user.rb:421:in `generate_avatar_thumbnails'
|
22
22
|
app/services/user_creator.rb:21:in `call'
|
23
23
|
app/controllers/users_controller.rb:49:in `create'
|
@@ -71,13 +71,15 @@ JobEnqueueLogger.configure do |config|
|
|
71
71
|
# Controls whether to print backtraces. Set to `true` to print backtraces, or
|
72
72
|
# a number to limit how many lines to print.
|
73
73
|
config.backtrace = false
|
74
|
+
|
75
|
+
# The logger to log to.
|
76
|
+
# Is set to Rails.logger by default, when the gem is used in the Rails app.
|
77
|
+
config.logger = nil
|
74
78
|
end
|
75
79
|
```
|
76
80
|
|
77
81
|
## Development
|
78
82
|
|
79
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
80
|
-
|
81
83
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
82
84
|
|
83
85
|
## Contributing
|
@@ -56,8 +56,8 @@ module JobEnqueueLogger
|
|
56
56
|
# Que.server? is defined in the newest version of Que - https://github.com/que-rb/que/pull/382
|
57
57
|
is_server = defined?(Que::CommandLineInterface)
|
58
58
|
|
59
|
-
if !is_server &&
|
60
|
-
|
59
|
+
if !is_server && JobEnqueueLogger.logger
|
60
|
+
JobEnqueueLogger.logger
|
61
61
|
elsif Que.logger.respond_to?(:call)
|
62
62
|
Que.logger.call
|
63
63
|
else
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module JobEnqueueLogger
|
4
4
|
module Utils
|
5
5
|
def self.log_job_enqueue(logger, message)
|
6
|
+
message = "[JobEnqueueLogger] #{message}"
|
6
7
|
return logger.info(message) unless JobEnqueueLogger.backtrace
|
7
8
|
|
8
9
|
backtrace = caller
|
@@ -19,10 +20,19 @@ module JobEnqueueLogger
|
|
19
20
|
|
20
21
|
def self.args_info(args)
|
21
22
|
if Array(args).any?
|
22
|
-
" with arguments: #{Array(args).map(
|
23
|
+
" with arguments: #{Array(args).map { |arg| format_arg(arg).inspect }.join(', ')}"
|
23
24
|
else
|
24
25
|
""
|
25
26
|
end
|
26
27
|
end
|
28
|
+
|
29
|
+
def self.format_arg(arg)
|
30
|
+
case arg
|
31
|
+
when String
|
32
|
+
arg.size > 100 ? "#{arg[0, 100]}…" : arg
|
33
|
+
else
|
34
|
+
arg
|
35
|
+
end
|
36
|
+
end
|
27
37
|
end
|
28
38
|
end
|
data/lib/job_enqueue_logger.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: job_enqueue_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fatkodima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Log background jobs enqueued by your application (additionally with backtraces).
|
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
rubygems_version: 3.4.
|
57
|
+
rubygems_version: 3.4.10
|
58
58
|
signing_key:
|
59
59
|
specification_version: 4
|
60
60
|
summary: Log background jobs enqueued by your application (additionally with backtraces).
|