-
Notifications
You must be signed in to change notification settings - Fork 74
[WIP] Move resource id param to logger initialize #570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[WIP] Move resource id param to logger initialize #570
Conversation
1a57f86
to
3666834
Compare
3666834
to
d1a9849
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good stuff
automation_log_wrapper.add(severity, message, progname, &block) | ||
|
||
severity ||= Logger::UNKNOWN | ||
return true if severity < @level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want our level, or the level of our wrapped log?
(that is the whole automation_log_wrapper.send("#{severity}?")
thing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we sync the :level
from the wrapped logger when we build it initially? I don't want to add more call-outs to the 'hard-coded' log_wrapper since I want to try to drop this and just use a normal broadcast
This pull request is not mergeable. Please rebase and repush. |
This pull request is not mergeable. Please rebase and repush. |
@@ -168,11 +168,13 @@ def self.with_automation_env | |||
private_class_method :with_automation_env | |||
|
|||
def self.process_ruby_method_results(return_code, msg, miq_request_id) | |||
logger = ManageIQ::AutomationEngine::Logger.create_log_wrapper(:resource_id => miq_request_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can simplify the creation of the logger even further. Moving a logger into the workspace is helpful, but also thinking about creating the log wrapper being an even simpler method.
ManageIQ::AutomationEngine.logger(miq_request_id)
That is just an example, haven't thought through this properly.
@@ -63,7 +67,7 @@ def self.instantiate_with_user(uri, user, attrs) | |||
|
|||
workspace | |||
rescue MiqAeException => err | |||
$miq_ae_logger.error(err.message, :resource_id => miq_request_id) | |||
workspace.logger.error(err.message, :resource_id => miq_request_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did the workspace.logger
allow us to no longer pass :resource_id
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, https://github.com/ManageIQ/manageiq-automation_engine/pull/570/files#diff-33fc5f7f8206b817c0ca3d4ad954ddb6c20cffd0aafc8c6b5c1966fb40804ecbR32
So we pass the resource_id during the initializer not on every log invocation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we can change this line?
workspace.logger.error(err.message, :resource_id => miq_request_id) | |
workspace.logger.error(err.message) |
No description provided.