Changeset 399
- Timestamp:
- Aug 14, 2022, 8:13:05 PM (2 years ago)
- Location:
- binary-improvements2/WebServer/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/WebServer/src/OpenID.cs
r391 r399 39 39 if (_errors == SslPolicyErrors.None) { 40 40 if (verboseSsl) { 41 Log.Out (" Steam certificate: No error (1)");41 Log.Out ("[OpenID] Steam certificate: No error (1)"); 42 42 } 43 43 … … 94 94 95 95 // This status is an error, print information 96 Log.Warning (" Steam certificate error: " + chainEl.Certificate.Subject + " ### Error: " +96 Log.Warning ("[OpenID] Steam certificate error: " + chainEl.Certificate.Subject + " ### Error: " + 97 97 chainStatus.Status); 98 98 privateChain.Reset (); … … 104 104 if (chainStatus.Status != X509ChainStatusFlags.NoError && 105 105 chainStatus.Status != X509ChainStatusFlags.UntrustedRoot) { 106 Log.Warning (" Steam certificate error: " + chainStatus.Status);106 Log.Warning ("[OpenID] Steam certificate error: " + chainStatus.Status); 107 107 privateChain.Reset (); 108 108 return false; … … 113 113 privateChain.Reset (); 114 114 if (verboseSsl) { 115 Log.Out (" Steam certificate: No error (4)");115 Log.Out ("[OpenID] Steam certificate: No error (4)"); 116 116 } 117 117 … … 136 136 string mode = getValue (_req, "openid.mode"); 137 137 if (mode == "cancel") { 138 Log.Warning (" Steam OpenID login canceled");138 Log.Warning ("[OpenID] Steam OpenID login canceled"); 139 139 return 0; 140 140 } 141 141 142 142 if (mode == "error") { 143 Log.Warning (" Steam OpenID login error: " + getValue (_req, "openid.error"));143 Log.Warning ("[OpenID] Steam OpenID login error: " + getValue (_req, "openid.error")); 144 144 if (debugOpenId) { 145 145 PrintOpenIdResponse (_req); … … 155 155 steamId = ulong.Parse (steamIdMatch.Groups [1].Value); 156 156 } else { 157 Log.Warning (" Steam OpenID login result did not give a valid SteamID");157 Log.Warning ("[OpenID] Steam OpenID login result did not give a valid SteamID"); 158 158 if (debugOpenId) { 159 159 PrintOpenIdResponse (_req); … … 201 201 } 202 202 203 Log.Warning (" Steam OpenID login failed: {0}", responseString);203 Log.Warning ("[OpenID] Steam OpenID login failed: {0}", responseString); 204 204 return 0; 205 205 } … … 218 218 NameValueCollection nvc = _req.QueryString; 219 219 if (nvc [_name] == null) { 220 throw new MissingMemberException (" OpenID parameter \"" + _name + "\" missing");220 throw new MissingMemberException ("[OpenID] OpenID parameter \"" + _name + "\" missing"); 221 221 } 222 222 -
binary-improvements2/WebServer/src/SSE/AbsEvent.cs
r391 r399 132 132 protected void logError (string _message, bool _printConnections) { 133 133 Log.Error (_printConnections 134 ? $" SSE ({Name}): {_message} (Left open: {currentlyOpen}, total opened: {totalOpened}, closed: {totalClosed})"135 : $" SSE ({Name}): {_message}");134 ? $"[Web] [SSE] '{Name}': {_message} (Left open: {currentlyOpen}, total opened: {totalOpened}, closed: {totalClosed})" 135 : $"[Web] [SSE] '{Name}': {_message}"); 136 136 } 137 137 -
binary-improvements2/WebServer/src/UrlHandlers/ApiHandler.cs
r394 r399 64 64 65 65 if (!apis.TryGetValue (apiName, out AbsWebAPI api)) { 66 Log. Out ($"Error in {nameof(ApiHandler)}.HandleRequest(): No handler found for API \"{apiName}\"");66 Log.Warning ($"[Web] In {nameof(ApiHandler)}.HandleRequest(): No handler found for API \"{apiName}\""); 67 67 _context.Response.StatusCode = (int) HttpStatusCode.NotFound; 68 68 return; … … 85 85 apiHandlerSampler.End (); 86 86 } catch (Exception e) { 87 Log.Error ($" Error in {nameof(ApiHandler)}.HandleRequest(): Handler {api.Name} threw an exception:");87 Log.Error ($"[Web] In {nameof(ApiHandler)}.HandleRequest(): Handler {api.Name} threw an exception:"); 88 88 Log.Exception (e); 89 89 _context.Response.StatusCode = (int) HttpStatusCode.InternalServerError; -
binary-improvements2/WebServer/src/UrlHandlers/ItemIconHandler.cs
r391 r399 28 28 if (!loaded) { 29 29 _context.Response.StatusCode = (int) HttpStatusCode.InternalServerError; 30 Log.Out (" Web:IconHandler: Icons not loaded");30 Log.Out ("[Web] IconHandler: Icons not loaded"); 31 31 return; 32 32 } … … 45 45 _context.Response.StatusCode = (int) HttpStatusCode.NotFound; 46 46 if (logMissingFiles) { 47 Log.Out (" Web:IconHandler:FileNotFound: \"" + _context.RequestPath + "\" ");47 Log.Out ("[Web] IconHandler: FileNotFound: \"" + _context.RequestPath + "\" "); 48 48 } 49 49 } … … 83 83 loadIconsFromFolder (GameIO.GetGameDir ("Data/ItemIcons"), tintedIcons); 84 84 } catch (Exception e) { 85 Log.Error (" Failed loading icons from base game");85 Log.Error ("[Web] Failed loading icons from base game"); 86 86 Log.Exception (e); 87 87 } … … 93 93 loadIconsFromFolder (modIconsPath, tintedIcons); 94 94 } catch (Exception e) { 95 Log.Error (" Failed loading icons from mod " + mod.ModInfo.Name.Value);95 Log.Error ("[Web] Failed loading icons from mod " + mod.ModInfo.Name.Value); 96 96 Log.Exception (e); 97 97 } … … 99 99 100 100 loaded = true; 101 Log.Out (" Web:IconHandler: Icons loaded - {0} ms", microStopwatch.ElapsedMilliseconds);101 Log.Out ("[Web] IconHandler: Icons loaded - {0} ms", microStopwatch.ElapsedMilliseconds); 102 102 103 103 return true; -
binary-improvements2/WebServer/src/UrlHandlers/SessionHandler.cs
r394 r399 70 70 WebConnection con = connectionHandler.LogIn (id, _context.Request.RemoteEndPoint.Address); 71 71 int level = GameManager.Instance.adminTools.GetUserPermissionLevel (con.UserId); 72 Log.Out (" Steam OpenID login from {0} with ID {1}, permission level {2}",72 Log.Out ("[Web] Steam OpenID login from {0} with ID {1}, permission level {2}", 73 73 remoteEndpointString, con.UserId, level); 74 74 … … 85 85 } 86 86 } catch (Exception e) { 87 Log.Error (" Error validatinglogin:");87 Log.Error ("[Web] Error validating Steam login:"); 88 88 Log.Exception (e); 89 89 } 90 90 91 Log.Out ($" Steam OpenID login failed from {remoteEndpointString}");91 Log.Out ($"[Web] Steam OpenID login failed from {remoteEndpointString}"); 92 92 _context.Response.Redirect (pageErrorPath + "SteamLoginFailed"); 93 93 } -
binary-improvements2/WebServer/src/UrlHandlers/SseHandler.cs
r391 r399 58 58 59 59 if (!events.TryGetValue (eventName, out AbsEvent eventInstance)) { 60 Log. Out ($"Error in {nameof (SseHandler)}.HandleRequest(): No handler found for event \"{eventName}\"");60 Log.Warning ($"[Web] [SSE] In {nameof (SseHandler)}.HandleRequest(): No handler found for event \"{eventName}\""); 61 61 _context.Response.StatusCode = (int)HttpStatusCode.NotFound; 62 62 return; … … 81 81 _context.Response.OutputStream.Flush (); 82 82 } catch (Exception e) { 83 Log.Error ($" Error in {nameof (SseHandler)}.HandleRequest(): Handler {eventInstance.Name} threw an exception:");83 Log.Error ($"[Web] [SSE] In {nameof (SseHandler)}.HandleRequest(): Handler {eventInstance.Name} threw an exception:"); 84 84 Log.Exception (e); 85 85 _context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; … … 99 99 eventHandler.ProcessSendQueue (); 100 100 } catch (Exception e) { 101 Log.Error ($" SSE ({eventName}): Error processing send queue");101 Log.Error ($"[Web] [SSE] '{eventName}': Error processing send queue"); 102 102 Log.Exception (e); 103 103 } -
binary-improvements2/WebServer/src/UrlHandlers/StaticHandler.cs
r391 r399 28 28 _context.Response.StatusCode = (int) HttpStatusCode.NotFound; 29 29 if (logMissingFiles) { 30 Log. Out ("Web:Static:FileNotFound: \"" + _context.RequestPath + "\" @ \"" + datapath + fn + "\"");30 Log.Warning ("[Web] Static: FileNotFound: \"" + _context.RequestPath + "\" @ \"" + datapath + fn + "\""); 31 31 } 32 32 } -
binary-improvements2/WebServer/src/WebAPI/GetPlayerList.cs
r394 r399 199 199 } 200 200 201 Log.Out (" GetPlayerList: ignoring invalid filter for number-column '{0}': '{1}'", _filterCol, _filterVal);201 Log.Out ("[Web] GetPlayerList: ignoring invalid filter for number-column '{0}': '{1}'", _filterCol, _filterVal); 202 202 return _list; 203 203 } -
binary-improvements2/WebServer/src/WebCommandResult.cs
r391 r399 58 58 } catch (IOException e) { 59 59 if (e.InnerException is SocketException) { 60 Log.Out ("Error in WebCommandResult.SendLines(): Remote host closed connection: " + 61 e.InnerException.Message); 60 Log.Warning ("[Web] Error in WebCommandResult.SendLines(): Remote host closed connection: " + e.InnerException.Message); 62 61 } else { 63 Log. Out ("Error (IO) in WebCommandResult.SendLines(): " + e);62 Log.Warning ("[Web] Error (IO) in WebCommandResult.SendLines(): " + e); 64 63 } 65 64 } catch (Exception e) { 66 Log. Out ("Error in WebCommandResult.SendLines(): " + e);65 Log.Warning ("[Web] Error in WebCommandResult.SendLines(): " + e); 67 66 } finally { 68 67 response?.Close (); -
binary-improvements2/WebServer/src/WebPermissions.cs
r395 r399 184 184 185 185 private void OnFileChanged (object _source, FileSystemEventArgs _e) { 186 Log.Out (" Reloading " + SettingsFileName);186 Log.Out ("[Web] [Perms] Reloading " + SettingsFileName); 187 187 Load (); 188 188 } … … 193 193 194 194 if (!File.Exists (SettingsFullPath)) { 195 Log.Out ($" Permissions file '{SettingsFileName}' not found, creating.");195 Log.Out ($"[Web] [Perms] Permissions file '{SettingsFileName}' not found, creating."); 196 196 Save (); 197 197 return; 198 198 } 199 199 200 Log.Out ($" Loading permissions file at '{SettingsFullPath}'");200 Log.Out ($"[Web] [Perms] Loading permissions file at '{SettingsFullPath}'"); 201 201 202 202 XmlDocument xmlDoc = new XmlDocument (); … … 205 205 xmlDoc.Load (SettingsFullPath); 206 206 } catch (XmlException e) { 207 Log.Error (" Failed loading permissions file: " + e.Message);207 Log.Error ("[Web] [Perms] Failed loading permissions file: " + e.Message); 208 208 return; 209 209 } … … 212 212 213 213 if (adminToolsNode == null) { 214 Log.Error (" Failed loading permissions file: No DocumentElement found");214 Log.Error ("[Web] [Perms] Failed loading permissions file: No DocumentElement found"); 215 215 return; 216 216 } … … 227 227 } 228 228 229 Log.Out (" Loading permissions file done.");229 Log.Out ("[Web] [Perms] Loading permissions file done."); 230 230 } 231 231 … … 237 237 238 238 if (subChild.NodeType != XmlNodeType.Element) { 239 Log.Warning ($" Unexpected XML node found in 'admintokens' section: {subChild.OuterXml}");239 Log.Warning ($"[Web] [Perms] Unexpected XML node found in 'admintokens' section: {subChild.OuterXml}"); 240 240 continue; 241 241 } … … 244 244 245 245 if (!lineItem.HasAttribute ("name")) { 246 Log.Warning ($" Ignoring admintoken-entry because of missing 'name' attribute: {subChild.OuterXml}");246 Log.Warning ($"[Web] [Perms] Ignoring admintoken-entry because of missing 'name' attribute: {subChild.OuterXml}"); 247 247 continue; 248 248 } 249 249 250 250 if (!lineItem.HasAttribute ("token")) { 251 Log.Warning ($" Ignoring admintoken-entry because of missing 'token' attribute: {subChild.OuterXml}");251 Log.Warning ($"[Web] [Perms] Ignoring admintoken-entry because of missing 'token' attribute: {subChild.OuterXml}"); 252 252 continue; 253 253 } 254 254 255 255 if (!lineItem.HasAttribute ("permission_level")) { 256 Log.Warning ($" Ignoring admintoken-entry because of missing 'permission_level' attribute: {subChild.OuterXml}");256 Log.Warning ($"[Web] [Perms] Ignoring admintoken-entry because of missing 'permission_level' attribute: {subChild.OuterXml}"); 257 257 continue; 258 258 } … … 262 262 if (!int.TryParse (lineItem.GetAttribute ("permission_level"), out int permissionLevel)) { 263 263 Log.Warning ( 264 $" Ignoring admintoken-entry because of invalid (non-numeric) value for 'permission_level' attribute: {subChild.OuterXml}");264 $"[Web] [Perms] Ignoring admintoken-entry because of invalid (non-numeric) value for 'permission_level' attribute: {subChild.OuterXml}"); 265 265 continue; 266 266 } … … 277 277 278 278 if (subChild.NodeType != XmlNodeType.Element) { 279 Log.Warning ($" Unexpected XML node found in 'permissions' section: {subChild.OuterXml}");279 Log.Warning ($"[Web] [Perms] Unexpected XML node found in 'permissions' section: {subChild.OuterXml}"); 280 280 continue; 281 281 } … … 284 284 285 285 if (!lineItem.HasAttribute ("module")) { 286 Log.Warning ($" Ignoring permission-entry because of missing 'module' attribute: {subChild.OuterXml}");286 Log.Warning ($"[Web] [Perms] Ignoring permission-entry because of missing 'module' attribute: {subChild.OuterXml}"); 287 287 continue; 288 288 } 289 289 290 290 if (!lineItem.HasAttribute ("permission_level")) { 291 Log.Warning ($" Ignoring permission-entry because of missing 'permission_level' attribute: {subChild.OuterXml}");291 Log.Warning ($"[Web] [Perms] Ignoring permission-entry because of missing 'permission_level' attribute: {subChild.OuterXml}"); 292 292 continue; 293 293 } … … 295 295 if (!int.TryParse (lineItem.GetAttribute ("permission_level"), out int permissionLevel)) { 296 296 Log.Warning ( 297 $" Ignoring permission-entry because of invalid (non-numeric) value for 'permission_level' attribute: {subChild.OuterXml}");297 $"[Web] [Perms] Ignoring permission-entry because of invalid (non-numeric) value for 'permission_level' attribute: {subChild.OuterXml}"); 298 298 continue; 299 299 }
Note:
See TracChangeset
for help on using the changeset viewer.