Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google::Cloud::Logging::Logger.class_eval do
%i{ debug info warn error }.each do |level|
old = instance_method level
define_method level do |message, entry_labels = {}, &block|
logger_labels = @labels if @labels
begin
@labels = (@labels || {}).merge entry_labels
old.bind(self).(message, &block)
ensure
@labels = logger_labels
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.