chore: remove obsolete log methods

This commit is contained in:
Andrew Welker
2025-03-25 21:53:41 -05:00
parent f6f731b470
commit 4d98191fa7
8 changed files with 309 additions and 581 deletions

View File

@@ -1,7 +1,9 @@
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.MobileControl; using PepperDash.Essentials.Room.MobileControl;
using Serilog.Events;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -50,13 +52,10 @@ namespace PepperDash.Essentials
if (parent == null) if (parent == null)
{ {
Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present"); bridge.LogInformation("ERROR: Cannot connect bridge. System controller not present");
return; return;
} }
Debug.Console(0, bridge, "Linking to parent controller"); bridge.LogInformation("Linking to parent controller");
/*bridge.AddParent(parent);
parent.AddBridge(bridge);*/
parent.AddDeviceMessenger(bridge); parent.AddDeviceMessenger(bridge);
}); });
@@ -70,8 +69,7 @@ namespace PepperDash.Essentials
if (mobileControlList.Count > 1) if (mobileControlList.Count > 1)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Warning, Debug.LogMessage(LogEventLevel.Warning, "Multiple instances of Mobile Control Server found.");
"Multiple instances of Mobile Control Server found.");
return null; return null;
} }
@@ -80,7 +78,7 @@ namespace PepperDash.Essentials
return mobileControlList[0]; return mobileControlList[0];
} }
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Mobile Control not enabled for this system"); Debug.LogMessage(LogEventLevel.Warning, "Mobile Control not enabled for this system");
return null; return null;
} }
} }

View File

@@ -5,6 +5,7 @@ using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.AppServer; using PepperDash.Essentials.AppServer;
using PepperDash.Essentials.AppServer.Messengers; using PepperDash.Essentials.AppServer.Messengers;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
@@ -592,7 +593,7 @@ namespace PepperDash.Essentials.Room.MobileControl
if (!Eisc.BooleanOutput[JoinMap.UseSourceEnabled.JoinNumber].BoolValue && string.IsNullOrEmpty(name)) if (!Eisc.BooleanOutput[JoinMap.UseSourceEnabled.JoinNumber].BoolValue && string.IsNullOrEmpty(name))
{ {
Debug.Console(1, "Source at join {0} does not have a name", JoinMap.SourceNameJoinStart.JoinNumber + i); this.LogDebug("Source at join {join} does not have a name", JoinMap.SourceNameJoinStart.JoinNumber + i);
break; break;
} }

View File

@@ -1,6 +1,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.AppServer.Messengers; using PepperDash.Essentials.AppServer.Messengers;
using PepperDash.Essentials.Core.DeviceTypeInterfaces; using PepperDash.Essentials.Core.DeviceTypeInterfaces;
@@ -19,7 +20,7 @@ namespace PepperDash.Essentials.Touchpanel
{ {
if (_appControl == null) if (_appControl == null)
{ {
Debug.Console(0, this, $"{_device.Key} does not implement ITswAppControl"); this.LogInformation("{deviceKey} does not implement ITswAppControl", _device.Key);
return; return;
} }

View File

@@ -1,6 +1,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.AppServer.Messengers; using PepperDash.Essentials.AppServer.Messengers;
using PepperDash.Essentials.Core.DeviceTypeInterfaces; using PepperDash.Essentials.Core.DeviceTypeInterfaces;
@@ -20,7 +21,7 @@ namespace PepperDash.Essentials.Touchpanel
{ {
if (_zoomControl == null) if (_zoomControl == null)
{ {
Debug.Console(0, this, $"{_device.Key} does not implement ITswZoomControl"); this.LogInformation("{deviceKey} does not implement ITswZoomControl", _device.Key);
return; return;
} }

View File

@@ -1,8 +1,10 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.AppServer.Messengers; using PepperDash.Essentials.AppServer.Messengers;
using PepperDash.Essentials.Core.Queues; using PepperDash.Essentials.Core.Queues;
using Serilog.Events;
using System; using System;
using System.Threading; using System.Threading;
using WebSocketSharp; using WebSocketSharp;
@@ -32,40 +34,32 @@ namespace PepperDash.Essentials
{ {
try try
{ {
if (_ws == null)
//Debug.Console(2, "Dispatching message type: {0}", msgToSend.GetType());
//Debug.Console(2, "Message: {0}", msgToSend.ToString());
//var messageToSend = JObject.FromObject(msgToSend);
if (_ws != null && _ws.IsAlive)
{ {
var message = JsonConvert.SerializeObject(msgToSend, Formatting.None, Debug.LogMessage(LogEventLevel.Warning, "Cannot send message. Websocket client is null");
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Converters = { new IsoDateTimeConverter() } }); return;
Debug.Console(2, "Message TX: {0}", message);
_ws.Send(message);
} }
else if (_ws == null)
if (!_ws.IsAlive)
{ {
Debug.Console(1, "Cannot send. No client."); Debug.LogMessage(LogEventLevel.Warning, "Cannot send message. Websocket client is not connected");
return;
} }
var message = JsonConvert.SerializeObject(msgToSend, Formatting.None,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Converters = { new IsoDateTimeConverter() } });
Debug.LogMessage(LogEventLevel.Verbose, "Message TX: {0}", null, message);
_ws.Send(message);
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "Caught an exception in the Transmit Processor {0}\r{1}\r{2}", ex.Message, ex.InnerException, ex.StackTrace); Debug.LogMessage(ex, "Caught an exception in the Transmit Processor");
Debug.Console(2, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.StackTrace);
if (ex.InnerException != null)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Inner Exception: {0}", ex.InnerException.Message);
Debug.Console(2, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.InnerException.StackTrace);
}
} }
} }
#endregion #endregion
} }
@@ -95,35 +89,33 @@ namespace PepperDash.Essentials
{ {
try try
{ {
//Debug.Console(2, "Message: {0}", msgToSend.ToString()); if(_server == null)
if (_server != null)
{ {
Debug.Console(2, _server, Debug.ErrorLogLevel.Notice, "Dispatching message type: {0}", msgToSend.GetType()); Debug.LogMessage(LogEventLevel.Warning, "Cannot send message. Server is null");
return;
var message = JsonConvert.SerializeObject(msgToSend, Formatting.None,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Converters = { new IsoDateTimeConverter() } });
var clientSpecificMessage = msgToSend as MobileControlMessage;
if (clientSpecificMessage.ClientId != null)
{
var clientId = clientSpecificMessage.ClientId;
Debug.Console(2, _server, "Message TX To Client ID: {0} Message: {1}", clientId, message);
_server.SendMessageToClient(clientId, message);
}
else
{
_server.SendMessageToAllClients(message);
Debug.Console(2, "Message TX To Clients: {0}", message);
}
} }
else if (_server == null)
var message = JsonConvert.SerializeObject(msgToSend, Formatting.None,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Converters = { new IsoDateTimeConverter() } });
var clientSpecificMessage = msgToSend as MobileControlMessage;
if (clientSpecificMessage.ClientId != null)
{ {
Debug.Console(1, "Cannot send. No server."); var clientId = clientSpecificMessage.ClientId;
_server.LogVerbose("Message TX To client {clientId} Message: {message}", clientId, message);
_server.SendMessageToClient(clientId, message);
return;
} }
_server.SendMessageToAllClients(message);
_server.LogVerbose("Message TX To all clients: {message}", null, message);
} }
catch (ThreadAbortException) catch (ThreadAbortException)
{ {
@@ -131,14 +123,7 @@ namespace PepperDash.Essentials
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "Caught an exception in the Transmit Processor {0}", ex.Message); Debug.LogMessage(ex,"Caught an exception in the Transmit Processor");
Debug.Console(2, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.StackTrace);
if (ex.InnerException != null)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "----\r\n{0}", ex.InnerException.Message);
Debug.Console(2, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.InnerException.StackTrace);
}
} }

View File

@@ -3,6 +3,7 @@ using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Web.RequestHandlers; using PepperDash.Core.Web.RequestHandlers;
using PepperDash.Essentials.Core.Web; using PepperDash.Essentials.Core.Web;
using Serilog.Events;
namespace PepperDash.Essentials.WebApiHandlers namespace PepperDash.Essentials.WebApiHandlers
{ {
@@ -113,7 +114,7 @@ namespace PepperDash.Essentials.WebApiHandlers
if (!server.Server.RemoveWebSocketService(path)) if (!server.Server.RemoveWebSocketService(path))
{ {
Debug.Console(0, $"Unable to remove client with token {request.Token}"); Debug.LogMessage(LogEventLevel.Warning, "Unable to remove client with token {token}", request.Token);
var response = new ClientResponse var response = new ClientResponse
{ {

View File

@@ -3,11 +3,13 @@ using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.AppServer.Messengers; using PepperDash.Essentials.AppServer.Messengers;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces; using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.Web; using PepperDash.Essentials.Core.Web;
using PepperDash.Essentials.WebApiHandlers; using PepperDash.Essentials.WebApiHandlers;
using Serilog.Events;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@@ -61,7 +63,7 @@ namespace PepperDash.Essentials
base.OnOpen(); base.OnOpen();
var url = Context.WebSocket.Url; var url = Context.WebSocket.Url;
Debug.Console(2, Debug.ErrorLogLevel.Notice, "New WebSocket Connection from: {0}", url); Debug.LogMessage(LogEventLevel.Verbose, "New WebSocket Connection from: {0}", null, url);
var match = Regex.Match(url.AbsoluteUri, "(?:ws|wss):\\/\\/.*(?:\\/mc\\/api\\/ui\\/join\\/)(.*)"); var match = Regex.Match(url.AbsoluteUri, "(?:ws|wss):\\/\\/.*(?:\\/mc\\/api\\/ui\\/join\\/)(.*)");
@@ -76,7 +78,7 @@ namespace PepperDash.Essentials
if (Controller == null) if (Controller == null)
{ {
Debug.Console(2, "WebSocket UiClient Controller is null"); Debug.LogMessage(LogEventLevel.Verbose, "WebSocket UiClient Controller is null");
_connectionTime = DateTime.Now; _connectionTime = DateTime.Now;
} }
@@ -91,37 +93,6 @@ namespace PepperDash.Essentials
}; };
Controller.HandleClientMessage(JsonConvert.SerializeObject(clientJoinedMessage)); Controller.HandleClientMessage(JsonConvert.SerializeObject(clientJoinedMessage));
// Inform controller of client joining
/*
var clientJoined = new MobileControlMessage
{
Type = "/system/roomKey",
ClientId = clientId,
Content = RoomKey,
};
Controller.SendMessageObjectToDirectClient(clientJoined);
if (Controller.Config.EnableUiMirroring)
{
var uiMirrorEnabled = new MobileControlMessage
{
Type = "/system/uiMirrorEnabled",
ClientId = clientId,
Content = JToken.FromObject(new MobileControlSimpleContent<bool> { Value = Controller.Config.EnableUiMirroring }),
};
var uiState = new MobileControlMessage
{
Type = "/system/uiMirrorState",
ClientId = clientId,
Content = Controller.LastUiState,
};
Controller.SendMessageObjectToDirectClient(uiMirrorEnabled);
Controller.SendMessageObjectToDirectClient(uiState);
}*/
var bridge = Controller.GetRoomBridge(RoomKey); var bridge = Controller.GetRoomBridge(RoomKey);
@@ -173,15 +144,14 @@ namespace PepperDash.Essentials
{ {
base.OnClose(e); base.OnClose(e);
Debug.Console(2, Debug.ErrorLogLevel.Notice, "WebSocket UiClient Closing: {0} reason: {1}", e.Code, e.Reason); Debug.LogMessage(LogEventLevel.Verbose, "WebSocket UiClient Closing: {0} reason: {1}", null, e.Code, e.Reason);
} }
protected override void OnError(ErrorEventArgs e) protected override void OnError(ErrorEventArgs e)
{ {
base.OnError(e); base.OnError(e);
Debug.Console(2, Debug.ErrorLogLevel.Notice, "WebSocket UiClient Error: {0} message: {1}", e.Exception, e.Message); Debug.LogMessage(LogEventLevel.Verbose, "WebSocket UiClient Error: {exception} message: {message}", e.Exception, e.Message);
} }
} }
@@ -333,7 +303,7 @@ namespace PepperDash.Essentials
if (apiServer == null) if (apiServer == null)
{ {
Debug.Console(0, this, "No API Server available"); this.LogInformation("No API Server available");
return; return;
} }
@@ -423,7 +393,7 @@ namespace PepperDash.Essentials
if (bridge == null) if (bridge == null)
{ {
Debug.Console(0, this, $"Unable to find room with key: {client.DefaultRoomKey}"); this.LogWarning("Unable to find room with key: {defaultRoomKey}", client.DefaultRoomKey);
return; return;
} }
@@ -431,7 +401,7 @@ namespace PepperDash.Essentials
if (key == null) if (key == null)
{ {
Debug.Console(0, this, $"Unable to generate a client for {client.Key}"); this.LogWarning("Unable to generate a client for {clientKey}", client.Key);
continue; continue;
} }
} }
@@ -440,7 +410,7 @@ namespace PepperDash.Essentials
var processorIp = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, lanAdapterId); var processorIp = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, lanAdapterId);
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, $"Processor IP: {processorIp}", this); this.LogVerbose("Processor IP: {processorIp}", processorIp);
foreach (var touchpanel in touchpanels.Select(tp => foreach (var touchpanel in touchpanels.Select(tp =>
{ {
@@ -453,19 +423,19 @@ namespace PepperDash.Essentials
{ {
if (touchpanel.Key == null) if (touchpanel.Key == null)
{ {
Debug.Console(0, this, $"Token for touchpanel {touchpanel.Touchpanel.Key} not found"); this.LogWarning("Token for touchpanel {touchpanelKey} not found", touchpanel.Touchpanel.Key);
continue; continue;
} }
if (touchpanel.Messenger == null) if (touchpanel.Messenger == null)
{ {
Debug.Console(2, this, $"Unable to find room messenger for {touchpanel.Touchpanel.DefaultRoomKey}"); this.LogWarning("Unable to find room messenger for {defaultRoomKey}", touchpanel.Touchpanel.DefaultRoomKey);
continue; continue;
} }
var appUrl = $"http://{processorIp}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}"; var appUrl = $"http://{processorIp}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}";
Debug.Console(2, this, $"Sending URL {appUrl}"); this.LogVerbose("Sending URL {appUrl}", appUrl);
touchpanel.Messenger.UpdateAppUrl($"http://{processorIp}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}"); touchpanel.Messenger.UpdateAppUrl($"http://{processorIp}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}");
} }
@@ -737,7 +707,7 @@ namespace PepperDash.Essentials
if (bridge == null) if (bridge == null)
{ {
Debug.Console(0, this, $"Unable to find room with key: {roomKey}"); this.LogWarning("Unable to find room with key: {roomKey}", roomKey);
return (null, null); return (null, null);
} }
@@ -926,7 +896,7 @@ namespace PepperDash.Essentials
var path = req.RawUrl; var path = req.RawUrl;
Debug.Console(2, this, "GET Request received at path: {0}", path); this.LogVerbose("GET Request received at path: {path}", path);
// Call for user app to join the room with a token // Call for user app to join the room with a token
if (path.StartsWith("/mc/api/ui/joinroom")) if (path.StartsWith("/mc/api/ui/joinroom"))
@@ -972,9 +942,9 @@ namespace PepperDash.Essentials
var path = req.RawUrl; var path = req.RawUrl;
var ip = req.RemoteEndPoint.Address.ToString(); var ip = req.RemoteEndPoint.Address.ToString();
Debug.Console(2, this, "POST Request received at path: {0} from host {1}", path, ip); this.LogVerbose("POST Request received at path: {path} from host {host}", path, ip);
var body = new System.IO.StreamReader(req.InputStream).ReadToEnd(); var body = new StreamReader(req.InputStream).ReadToEnd();
if (path.StartsWith("/mc/api/log")) if (path.StartsWith("/mc/api/log"))
{ {
@@ -990,7 +960,7 @@ namespace PepperDash.Essentials
await LogClient.SendAsync(logRequest); await LogClient.SendAsync(logRequest);
Debug.Console(2, this, "Log data sent to {0}:{1}", _parent.Config.DirectServer.Logging.Host, _parent.Config.DirectServer.Logging.Port); this.LogVerbose("Log data sent to {host}:{port}", _parent.Config.DirectServer.Logging.Host, _parent.Config.DirectServer.Logging.Port);
} }
else else
{ {
@@ -1000,7 +970,7 @@ namespace PepperDash.Essentials
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.LogMessage(ex, "Caught an exception in the OnPost handler", this); this.LogException(ex, "Caught an exception in the OnPost handler");
} }
} }
@@ -1033,7 +1003,7 @@ namespace PepperDash.Essentials
var qp = req.QueryString; var qp = req.QueryString;
var token = qp["token"]; var token = qp["token"];
Debug.Console(2, this, "Join Room Request with token: {0}", token); this.LogVerbose("Join Room Request with token: {token}", token);
if (UiClients.TryGetValue(token, out UiClientContext clientContext)) if (UiClients.TryGetValue(token, out UiClientContext clientContext))
@@ -1074,10 +1044,11 @@ namespace PepperDash.Essentials
var message = string.Format("Unable to find bridge with key: {0}", clientContext.Token.RoomKey); var message = string.Format("Unable to find bridge with key: {0}", clientContext.Token.RoomKey);
res.StatusCode = 404; res.StatusCode = 404;
res.ContentType = "application/json"; res.ContentType = "application/json";
this.LogVerbose("{message}", message);
var body = Encoding.UTF8.GetBytes(message); var body = Encoding.UTF8.GetBytes(message);
res.ContentLength64 = body.LongLength; res.ContentLength64 = body.LongLength;
res.Close(body, true); res.Close(body, true);
Debug.Console(2, this, "{0}", message);
} }
} }
else else
@@ -1085,7 +1056,7 @@ namespace PepperDash.Essentials
var message = "Token invalid or has expired"; var message = "Token invalid or has expired";
res.StatusCode = 401; res.StatusCode = 401;
res.ContentType = "application/json"; res.ContentType = "application/json";
Debug.Console(2, this, "{0}", message); this.LogVerbose("{message}", message);
var body = Encoding.UTF8.GetBytes(message); var body = Encoding.UTF8.GetBytes(message);
res.ContentLength64 = body.LongLength; res.ContentLength64 = body.LongLength;
res.Close(body, true); res.Close(body, true);
@@ -1102,7 +1073,7 @@ namespace PepperDash.Essentials
res.ContentType = "application/json"; res.ContentType = "application/json";
var version = new Version() { ServerVersion = _parent.GetConfigWithPluginVersion().RuntimeInfo.PluginVersion }; var version = new Version() { ServerVersion = _parent.GetConfigWithPluginVersion().RuntimeInfo.PluginVersion };
var message = JsonConvert.SerializeObject(version); var message = JsonConvert.SerializeObject(version);
Debug.Console(2, this, "{0}", message); this.LogVerbose("{message}", message);
var body = Encoding.UTF8.GetBytes(message); var body = Encoding.UTF8.GetBytes(message);
res.ContentLength64 = body.LongLength; res.ContentLength64 = body.LongLength;
@@ -1118,7 +1089,7 @@ namespace PepperDash.Essentials
{ {
var path = req.RawUrl; var path = req.RawUrl;
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Requesting Image: {0}", this, path); Debug.LogMessage(LogEventLevel.Verbose, "Requesting Image: {0}", this, path);
var imageBasePath = Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo" + Global.DirectorySeparator; var imageBasePath = Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo" + Global.DirectorySeparator;
@@ -1126,9 +1097,9 @@ namespace PepperDash.Essentials
var filePath = imageBasePath + image; var filePath = imageBasePath + image;
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Retrieving Image: {0}", this, filePath); Debug.LogMessage(LogEventLevel.Verbose, "Retrieving Image: {0}", this, filePath);
if (System.IO.File.Exists(filePath)) if (File.Exists(filePath))
{ {
if(filePath.EndsWith(".png")) if(filePath.EndsWith(".png"))
{ {
@@ -1165,7 +1136,7 @@ namespace PepperDash.Essentials
/// <param name="path"></param> /// <param name="path"></param>
private void HandleUserAppRequest(HttpListenerRequest req, HttpListenerResponse res, string path) private void HandleUserAppRequest(HttpListenerRequest req, HttpListenerResponse res, string path)
{ {
Debug.Console(2, this, "Requesting User app file..."); this.LogVerbose("Requesting User app file");
var qp = req.QueryString; var qp = req.QueryString;
var token = qp["token"]; var token = qp["token"];
@@ -1189,7 +1160,7 @@ namespace PepperDash.Essentials
// swap the base href prefix for the file path prefix // swap the base href prefix for the file path prefix
filePath = filePath.Replace(_userAppBaseHref, _appPath); filePath = filePath.Replace(_userAppBaseHref, _appPath);
Debug.Console(2, this, "filepath: {0}", filePath); this.LogVerbose("filepath: {filePath}", filePath);
// append index.html if no specific file is specified // append index.html if no specific file is specified
@@ -1208,7 +1179,7 @@ namespace PepperDash.Essentials
// Set ContentType based on file type // Set ContentType based on file type
if (filePath.EndsWith(".html")) if (filePath.EndsWith(".html"))
{ {
Debug.Console(2, this, "Client requesting User App..."); this.LogVerbose("Client requesting User App");
res.ContentType = "text/html"; res.ContentType = "text/html";
} }
@@ -1228,17 +1199,17 @@ namespace PepperDash.Essentials
} }
} }
Debug.Console(2, this, "Attempting to serve file: {0}", filePath); this.LogVerbose("Attempting to serve file: {filePath}", filePath);
byte[] contents; byte[] contents;
if (System.IO.File.Exists(filePath)) if (System.IO.File.Exists(filePath))
{ {
Debug.Console(2, this, "File found"); this.LogVerbose("File found: {filePath}", filePath);
contents = System.IO.File.ReadAllBytes(filePath); contents = System.IO.File.ReadAllBytes(filePath);
} }
else else
{ {
Debug.Console(2, this, "File not found: {0}", filePath); this.LogVerbose("File not found: {filePath}", filePath);
res.StatusCode = (int)HttpStatusCode.NotFound; res.StatusCode = (int)HttpStatusCode.NotFound;
res.Close(); res.Close();
return; return;
@@ -1250,7 +1221,7 @@ namespace PepperDash.Essentials
public void StopServer() public void StopServer()
{ {
Debug.Console(2, this, "Stopping WebSocket Server"); this.LogVerbose("Stopping WebSocket Server");
_server.Stop(CloseStatusCode.Normal, "Server Shutting Down"); _server.Stop(CloseStatusCode.Normal, "Server Shutting Down");
} }
@@ -1295,7 +1266,7 @@ namespace PepperDash.Essentials
} }
else else
{ {
Debug.Console(0, this, "Unable to find client with ID: {0}", clientId); this.LogWarning("Unable to find client with ID: {clientId}", clientId);
} }
} }
} }