Actualiza la inicialización de traza+localización

This commit is contained in:
Manuel Cillero 2022-03-01 23:42:37 +01:00
parent cac4c2f102
commit 67952f6840
7 changed files with 12 additions and 12 deletions

View file

@ -2,4 +2,4 @@
pub const CONFIG_DIR: &'static str = "config"; pub const CONFIG_DIR: &'static str = "config";
mod settings; mod settings;
pub use crate::config::settings::{CONFIG, SETTINGS}; pub use settings::{CONFIG, SETTINGS};

View file

@ -1,4 +1,4 @@
use crate::{Lazy, base, locale, trace}; use crate::{Lazy, base, trace};
use crate::config::SETTINGS; use crate::config::SETTINGS;
use crate::core::{Server, all, server}; use crate::core::{Server, all, server};
use crate::core::module::register_module; use crate::core::module::register_module;
@ -32,11 +32,11 @@ pub fn run(bootstrap: Option<fn()>) -> Result<Server, std::io::Error> {
); );
} }
// Traza de seguimiento. // Inicia la traza de la aplicación.
Lazy::force(&trace::TRACING); Lazy::force(&server::tracing::TRACING);
// Identificador de idioma. // Asigna identificador de idioma.
Lazy::force(&locale::LANGID); Lazy::force(&server::langid::LANGID);
// Ejecuta la función de inicio de la aplicación. // Ejecuta la función de inicio de la aplicación.
if bootstrap != None { if bootstrap != None {

View file

@ -2,5 +2,10 @@ pub use actix_web::{
App, HttpRequest, HttpResponse, HttpServer, Responder, Result, http, web App, HttpRequest, HttpResponse, HttpServer, Responder, Result, http, web
}; };
mod tracing;
mod langid;
pub use langid::LANGID;
mod main; mod main;
pub use main::run; pub use main::run;

View file

@ -2,14 +2,12 @@ pub use fluent_templates::{static_loader as static_locale, Loader as Locale};
pub use fluent_templates; pub use fluent_templates;
pub use fluent_templates::fluent_bundle::FluentValue; pub use fluent_templates::fluent_bundle::FluentValue;
mod locale;
pub use locale::LANGID;
#[macro_export] #[macro_export]
/// Permite integrar fácilmente localización en temas, módulos y componentes. /// Permite integrar fácilmente localización en temas, módulos y componentes.
macro_rules! localize { macro_rules! localize {
( $DEF_LANGID:literal, $locales:literal $(, $core_locales:literal)? ) => { ( $DEF_LANGID:literal, $locales:literal $(, $core_locales:literal)? ) => {
use $crate::locale::*; use $crate::locale::*;
use $crate::core::server::LANGID;
static_locale! { static_locale! {
static LOCALES = { static LOCALES = {

View file

@ -1,5 +1,2 @@
pub use tracing::{Level, event, span}; pub use tracing::{Level, event, span};
pub use tracing::{debug, error, info, trace, warn}; pub use tracing::{debug, error, info, trace, warn};
mod trace;
pub use trace::TRACING;