Mercurial > hg
comparison rust/hg-cpython/src/dirstate.rs @ 44540:82f51ab7a2dd
rust: add logging utils
This change adds the `log` crate, the community-approved logging facade backed
by Rust core developers as well as the logging-consumer crate `simple_logger`
to build a foundation for logging from Rust.
Using this setup allows us to choose how to log depending on the way `hg-core`
is used: if it's within the context of `hg-cpython`, we might not want to use
it the same way as with a direct cli for example.
Differential Revision: https://phab.mercurial-scm.org/D8252
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Fri, 06 Mar 2020 18:08:13 +0100 |
parents | f96b28aa4b79 |
children | 01afda7e7d6c |
comparison
equal
deleted
inserted
replaced
44539:fe7d2cf0b429 | 44540:82f51ab7a2dd |
---|---|
105 /// Create the module, with `__package__` given from parent | 105 /// Create the module, with `__package__` given from parent |
106 pub fn init_module(py: Python, package: &str) -> PyResult<PyModule> { | 106 pub fn init_module(py: Python, package: &str) -> PyResult<PyModule> { |
107 let dotted_name = &format!("{}.dirstate", package); | 107 let dotted_name = &format!("{}.dirstate", package); |
108 let m = PyModule::new(py, dotted_name)?; | 108 let m = PyModule::new(py, dotted_name)?; |
109 | 109 |
110 simple_logger::init_by_env(); | |
111 | |
110 m.add(py, "__package__", package)?; | 112 m.add(py, "__package__", package)?; |
111 m.add(py, "__doc__", "Dirstate - Rust implementation")?; | 113 m.add(py, "__doc__", "Dirstate - Rust implementation")?; |
112 | 114 |
113 m.add( | 115 m.add( |
114 py, | 116 py, |