I see many console log messages in the browser generated by Sonata admin bundle.

These messages are generated from /vendor/sonata-project/admin-bundle/src/Resources/public/Admin.js by the code,
/**
* render log message
* @param mixed
*/
log: function() {
var msg = '[Sonata.Admin] ' + Array.prototype.join.call(arguments,', ');
if (window.console && window.console.log) {
window.console.log(msg);
} else if (window.opera && window.opera.postError) {
window.opera.postError(msg);
}
},
I don't need these logs to be generated in the browser. Is there a way to control these from configuration file or something?
Does these logs occur on prod?
Yes. Both dev and prod environment.
You can customize the layout and override that function:
{% extends 'SonataAdminBundle::standard_layout.html.twig' %}
{% block javascripts %}
{{ parent() }}
<script>
if ('undefined' !== typeof window.Admin) {
window.Admin.log = function() {}
}
</script>
{% endblock %}
@bgaleotti Thanks, it works.
But logging console messages even in production environment is the actual implementation or is it a bug?
IMHO we should switch the actual behaviour. So that we have a logger function that does nothing, but you can override/enable it if you want
Yes, I have overrided the standard_layout to disable it. Thanks for the support. Can I close this issue now?
No please keep it to open until we have a better solution
Sure
Most helpful comment
IMHO we should switch the actual behaviour. So that we have a logger function that does nothing, but you can override/enable it if you want