whatyouhide/corsica

Feedback - Granular Logging Support

zmoshansky opened this issue · 2 comments

Would you be open to supporting granular logging? The motivation being that I care very much if CORS requests fail and don't even want to see when they succeed. I think much of the logging is very very useful for development, but filtering the important stuff would be nice for prd.

Simple

  • failed request -> :error or whatever is specified in opts[:log]
  • successful request -> :debug or none if specified in opts[:log] == :none

More elaborately

  • option to disable all, or specify what log level failure messages use
  • blocked domain -> :error or whatever is specified in opts[:log]
  • invalid request -> :debug/:info or whatever is specified in opts[:log]
  • successful request -> :debug or none if specified in opts[:log] == :none

Alternatives A

Only log failed requests according to the opts[:log] in prd.

Alternatives B

config :corsica, :log,
  [
    blocked: :error,
    invalid: :debug,
    success: :log,
  ]

Hey @zmoshansky, thanks for the suggestions. I'll look into this in the next few days and I hope I'll have a good way to solve this :). Instinctively, I'm 👎 on Alternative B as it introduces too much complexity in a library which should be as simple as possible. I still have to figure out a good way to solve the logging problem, which is turning out to be the hardest problem in Corsica 😄

The "next few days" turned out to be the "next few months" but I added support for something similar to Alternative B (just in the plug options instead of the options for the :corsica application) in 636e4d7. I'm still not sure about this solution and indeed this is quite a nasty problem, but I'll close this for now. If I come up with something better, then 👍 , otherwise ¯_(ツ)_/¯