task_bunny icon indicating copy to clipboard operation
task_bunny copied to clipboard

[RFC] Add ability to inject custom logger

Open PhillippOhlandt opened this issue 7 years ago • 4 comments

Hey,

what do you guys think about being able to inject a custom logger module? I had to set my apps Logger settings to :info because the task bunny debug messages were a little bit too much. With a custom logger, I could have overridden that behaviour.

PhillippOhlandt avatar Jul 26 '17 13:07 PhillippOhlandt

Thanks for the suggestion. I would like to avoid to introduce the complexity by that. Do you know any other Elixir libraries doing that a neat way? If so, I am happy to take a look though.

Do you have any particular log outputs you want to turn off?

ono avatar Jul 26 '17 14:07 ono

I saw you have custom error handlers. Something like that just for normal log output would be nice.

What bugged me was the amount of log output I got when enqueuing a job.

iex(1)> Worker.Jobs.TestJob.enqueue!(%{"name" => "baz"})

16:33:29.364 [debug] TaskBunny.Publisher: publish
default:xxx.normal: "{\n  \"payload\": {\n    \"name\": \"baz\"\n  },\n  \"job\": \"Worker.Jobs.TestJob\",\n  \"created_at\": \"2017-07-26T14:33:29.361054Z\"\n}". options = []


16:33:29.369 [debug] TaskBunny.Worker: basic_deliver. Queue: xxx.normal. Concurrency: 1. PID: #PID<0.468.0>. [body: "{\n  \"payload\": {\n    \"name\": \"baz\"\n  },\n  \"job\": \"Worker.Jobs.TestJob\",\n  \"created_at\": \"2017-07-26T14:33:29.361054Z\"\n}"]
:ok
iex(2)> Hello baz

16:33:30.375 [debug] TaskBunny.Worker: job_finished. Queue: xxx.normal. Concurrency: 1. PID: #PID<0.468.0>. [body: "{\n  \"payload\": {\n    \"name\": \"baz\"\n  },\n  \"job\": \"Worker.Jobs.TestJob\",\n  \"created_at\": \"2017-07-26T14:33:29.361054Z\"\n}", meta: %{app_id: :undefined, cluster_id: :undefined, consumer_tag: "amq.ctag-P3INaDKGZPPV56oY35dBXA", content_encoding: :undefined, content_type: :undefined, correlation_id: :undefined, delivery_tag: 1, exchange: "", expiration: :undefined, headers: :undefined, message_id: :undefined, persistent: true, priority: :undefined, redelivered: false, reply_to: :undefined, routing_key: "video_search.normal", timestamp: :undefined, type: :undefined, user_id: :undefined}]

Maybe it can be reduced (triggered by config option)?

PhillippOhlandt avatar Jul 26 '17 14:07 PhillippOhlandt

I see. I will have a think what I can do.

ono avatar Jul 26 '17 15:07 ono

It's not urgent. I set the logger log-level to :info, that works for me now.

PhillippOhlandt avatar Jul 26 '17 15:07 PhillippOhlandt