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

View file

@ -2,5 +2,10 @@ pub use actix_web::{
App, HttpRequest, HttpResponse, HttpServer, Responder, Result, http, web
};
mod tracing;
mod langid;
pub use langid::LANGID;
mod main;
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::fluent_bundle::FluentValue;
mod locale;
pub use locale::LANGID;
#[macro_export]
/// Permite integrar fácilmente localización en temas, módulos y componentes.
macro_rules! localize {
( $DEF_LANGID:literal, $locales:literal $(, $core_locales:literal)? ) => {
use $crate::locale::*;
use $crate::core::server::LANGID;
static_locale! {
static LOCALES = {

View file

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