[IMP]Hy base : add Odoo debug logger

This commit is contained in:
Fabien BOURGEOIS 2019-09-22 15:29:29 +02:00
parent 0e598ee766
commit f2ac8b6f09
1 changed files with 4 additions and 2 deletions

View File

@ -17,7 +17,8 @@
" Odoo XML macros "
(import [odoo.addons.hy_base.xml [*]])
(import logging [odoo.addons.hy_base.xml [*]])
(setv logger (.getLogger logging __name__))
(defmacro if-python2 [python2-form python3-form]
"If running on python2, execute python2-form, else, execute python3-form"
@ -92,4 +93,5 @@
(setv ~g!output-xml (.decode (.tostring ET ~tree) "utf-8")))
(setv ~g!output-path (.dirname path (.abspath path __file__))
~g!fpath (+ ~g!output-path "/" ~filename))
(with [f (open ~g!fpath "w")] (.write f ~g!output-xml))))
(.debug logger (+ "Hy XML DSL : compiling " ~filename " to " ~g!output-path))
(with [f (open ~g!fpath "w")] (.write f ~g!output-xml))))