Add comprehensive documentation and unit tests
Documentation: - Add detailed README files for all services (auth, character, database, launcher, packet, utils, world) - Create API documentation for the database service with detailed endpoint specifications - Document database schema and relationships - Add service architecture overviews and configuration instructions Unit Tests: - Implement comprehensive test suite for database repositories (user, character, session) - Add gRPC service tests for database interactions - Create tests for packet service components (bufferpool, connection, packets) - Add utility service tests (health check, logging, load balancer, redis cache, service discovery) - Implement auth service user tests - Add character service tests Code Structure: - Reorganize test files into a more consistent structure - Create a dedicated tests crate for integration testing - Add test helpers and mock implementations for easier testing
This commit is contained in:
@@ -4,23 +4,21 @@ use tracing_subscriber::EnvFilter;
|
||||
|
||||
pub fn setup_logging(app_name: &str, additional_crates: &[&str]) {
|
||||
let log_level = env::var("LOG_LEVEL").unwrap_or_else(|_| "info".to_string());
|
||||
|
||||
|
||||
let mut filter_string = format!("{app_name}={log_level},utils={log_level}");
|
||||
for (crate_name) in additional_crates {
|
||||
for &crate_name in additional_crates {
|
||||
filter_string.push(',');
|
||||
filter_string.push_str(&format!("{crate_name}={log_level}"));
|
||||
}
|
||||
|
||||
let filter = EnvFilter::try_new(filter_string)
|
||||
.unwrap_or_else(|_| EnvFilter::new(format!("{app_name}=info,utils=info")));
|
||||
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(filter)
|
||||
.init();
|
||||
|
||||
let filter =
|
||||
EnvFilter::try_new(filter_string).unwrap_or_else(|_| EnvFilter::new(format!("{app_name}=info,utils=info")));
|
||||
|
||||
tracing_subscriber::fmt().with_env_filter(filter).init();
|
||||
|
||||
error!("Error messages enabled");
|
||||
warn!("Warning messages enabled");
|
||||
info!("Info messages enabled");
|
||||
debug!("Debug messages enabled");
|
||||
trace!("Trace messages enabled");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user