this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

rawr logs

Mar ec0fecdb 3a4e5899

+53 -34
+15 -19
server/src/client_communication.rs
··· 1 1 use crate::user::User; 2 2 use crate::{AppState, LuminaError}; 3 - use cynthia_con::CynthiaColors; 3 + use cynthia_con::{CynthiaColors, CynthiaStyles}; 4 4 extern crate rocket; 5 5 use rocket::State; 6 6 use tracing::info; 7 - use ws; 8 7 9 8 #[get("/connection")] 10 9 pub(crate) fn wsconnection<'k>(ws: ws::WebSocket, state: &'k State<AppState>) -> ws::Channel<'k> { 11 10 use rocket::futures::{SinkExt, StreamExt}; 12 - 11 + // Just a few log prefixes 12 + let incoming = "[INCOMING]".color_lilac().style_bold(); 13 + let registrationerror = "[RegistrationError]".color_bright_red().style_bold(); 13 14 ws.channel(move |mut stream| { 14 15 Box::pin(async move { 15 16 let mut client_session_data: SessionData = SessionData { ··· 38 39 password, 39 40 }) => { 40 41 println!( 41 - "Register request: {} {}", 42 + "{incoming} {} {} {}", 43 + "Register request" 42 44 email.clone().color_orange(), 43 45 username.clone().color_bright_cyan() 44 46 ); ··· 95 97 Err(e) => { 96 98 match e { 97 99 LuminaError::RegisterUsernameInUse => { 98 - warn!( 99 - "{} User {} already exists", 100 - "[RegistrationError]" 101 - .color_bright_red(), 100 + println!( 101 + "{registrationerror} User {} already exists", 102 102 username.clone().color_bright_cyan() 103 103 ); 104 104 } 105 105 LuminaError::RegisterEmailNotValid => { 106 - warn!( 107 - "{} Email {} is not valid", 108 - "[RegistrationError]" 109 - .color_bright_red(), 106 + println!( 107 + "{registrationerror} Email {} is not valid", 108 + 110 109 email.clone().color_bright_cyan() 111 110 ); 112 111 } 113 112 LuminaError::RegisterUsernameInvalid(why) => { 114 - warn!( 115 - "{} Username {} is not valid: {}", 116 - "[RegistrationError]" 117 - .color_bright_red(), 113 + println!( 114 + "{registrationerror} Username '{}' is not valid: {}", 118 115 username.clone().color_bright_cyan(), 119 116 why 120 117 ); 121 118 } 122 119 LuminaError::RegisterPasswordNotValid(why) => { 123 - warn!( 124 - "{} Password is not valid: {}", 125 - "[RegistrationError]".color_bright_red(), 120 + println!( 121 + "{registrationerror} Password is not valid: {}", 126 122 why 127 123 ); 128 124 }
+5 -6
server/src/database.rs
··· 1 - use cynthia_con::{CynthiaColors, CynthiaStyles}; 2 1 use crate::errors::LuminaError::{self, ConfMissing}; 2 + use cynthia_con::{CynthiaColors, CynthiaStyles}; 3 3 use r2d2::Pool; 4 - use r2d2_sqlite; 5 4 use r2d2_sqlite::SqliteConnectionManager; 6 5 use tokio_postgres as postgres; 7 6 use tokio_postgres::tls::NoTlsStream; ··· 130 129 131 130 c => { 132 131 println!("{:?}", c); 133 - Err(LuminaError::ConfInvalid( 134 - format!("LUMINA_DB_TYPE does not contain a valid value, only 'sqlite' or 'postgres' are allowed. Found: {}", c) 135 - 136 - )) 132 + Err(LuminaError::ConfInvalid(format!( 133 + "LUMINA_DB_TYPE does not contain a valid value, only 'sqlite' or 'postgres' are allowed. Found: {}", 134 + c 135 + ))) 137 136 } 138 137 } 139 138 }
+33 -9
server/src/main.rs
··· 71 71 process::exit(1); 72 72 } 73 73 Err(LuminaError::Sqlite(a)) => { 74 - eprintln!("{} While opening sqlite database: {}", "[ERROR]".color_error_red().style_bold(),a); 74 + eprintln!( 75 + "{} While opening sqlite database: {}", 76 + "[ERROR]".color_error_red().style_bold(), 77 + a 78 + ); 75 79 process::exit(1); 76 80 } 77 81 Err(LuminaError::Postgres(a)) => { 78 - eprintln!("{} While connecting to postgres database: {}", "[ERROR]".color_error_red().style_bold(), a); 82 + eprintln!( 83 + "{} While connecting to postgres database: {}", 84 + "[ERROR]".color_error_red().style_bold(), 85 + a 86 + ); 79 87 process::exit(1); 80 88 } 81 89 Err(_) => { 82 - eprintln!("{} Unknown error: could not setup database connection.", "[ERROR]".color_error_red().style_bold()); 90 + eprintln!( 91 + "{} Unknown error: could not setup database connection.", 92 + "[ERROR]".color_error_red().style_bold() 93 + ); 83 94 process::exit(1); 84 95 } 85 96 }; ··· 110 121 match result { 111 122 Ok(_) => {} 112 123 Err(LuminaError::RocketFaillure(e)) => { 113 - eprintln!("{} Error starting server: {:?}", "[ERROR]".color_error_red().style_bold(), e); 124 + eprintln!( 125 + "{} Error starting server: {:?}", 126 + "[ERROR]".color_error_red().style_bold(), 127 + e 128 + ); 114 129 } 115 130 Err(_) => { 116 - eprintln!("{} Unknown error starting server.", "[ERROR]".color_error_red().style_bold()); 131 + eprintln!( 132 + "{} Unknown error starting server.", 133 + "[ERROR]".color_error_red().style_bold() 134 + ); 117 135 } 118 136 } 119 137 } 120 138 Err(LuminaError::ConfMissing(a)) => { 121 139 eprintln!( 122 140 "{} Missing environment variable {}, which is required to continue. Please make sure it is set, or change other variables to make it redundant, if possible.", 123 - "[ERROR]".color_error_red().style_bold() 124 - , 141 + "[ERROR]".color_error_red().style_bold(), 125 142 a.color_bright_orange() 126 143 ); 127 144 process::exit(1); 128 145 } 129 146 Err(LuminaError::ConfInvalid(a)) => { 130 - eprintln!("{} Invalid environment variable: {}", "[ERROR]".color_error_red().style_bold(),a.color_bright_orange()); 147 + eprintln!( 148 + "{} Invalid environment variable: {}", 149 + "[ERROR]".color_error_red().style_bold(), 150 + a.color_bright_orange() 151 + ); 131 152 process::exit(1); 132 153 } 133 154 Err(_) => { 134 - eprintln!("{} Unknown error: could not setup server configuration.", "[ERROR]".color_error_red().style_bold()); 155 + eprintln!( 156 + "{} Unknown error: could not setup server configuration.", 157 + "[ERROR]".color_error_red().style_bold() 158 + ); 135 159 process::exit(1); 136 160 } 137 161 };