public static void Log(EVerbosityLevel Verbosity, ELogColour TextColour, string Line) { // Only consider the line if it's not the highest level of verbosity // unless the highest level of verbosity is what is being asked for if ((EVerbosityLevel.SuperVerbose != Verbosity) || (EVerbosityLevel.SuperVerbose == AgentApplication.Options.Verbosity)) { bool bShouldLogToConsole = Verbosity <= AgentApplication.Options.Verbosity; lock (LogFileLock) { // Log the line out to the file, if it exists if (LogFile != null) { LogFile.WriteLine(Line); } else { // If the file doesn't exist, always log to the console bShouldLogToConsole = true; } } if (bShouldLogToConsole) { LogLines.Enqueue(new SwarmAgentWindow.LogLine(Verbosity, TextColour, Line)); } } }
/////////////////////////////////////////////////////////////////////////// /* * Logs a line of text to the agent log window */ public Int32 Log(EVerbosityLevel Verbosity, ELogColour TextColour, string Line) { AgentApplication.Log(Verbosity, TextColour, Line); return(Constants.SUCCESS); }
public LogLine(EVerbosityLevel InVerbosity, ELogColour InColour, string InLine) { Verbosity = InVerbosity; Colour = InColour; Line = InLine; }
static int SwarmLog(EVerbosityLevel Verbosity, ELogColour TextColour, IntPtr Message) { try { return GInstance.Log((EVerbosityLevel)Verbosity, (ELogColour)TextColour, FStringMarshaler.MarshalNativeToManaged(Message)); } catch(Exception Ex) { DebugLog.Write(Ex.Message + "\n" + Ex.ToString()); return 0; } }
/////////////////////////////////////////////////////////////////////////// public Int32 Log(EVerbosityLevel Verbosity, ELogColour TextColour, String Line) { LogDelegate DLog = Connection.Log; // Invoke the method, then wait for it to finish or to be notified that the connection dropped IAsyncResult Result = DLog.BeginInvoke(Verbosity, TextColour, Line, null, null); WaitHandle.WaitAny(new WaitHandle[]{ Result.AsyncWaitHandle, ConnectionDroppedEvent }); // If the method completed normally, return the result if (Result.IsCompleted) { // If the invocation completed, success return DLog.EndInvoke(Result); } // Otherwise, error return Constants.ERROR_CONNECTION_DISCONNECTED; }
/** * Adds a line of text to the Agent log window * * @param Verbosity the importance of this message * @param TextColour the colour of the text * @param Message the line of text to add */ public virtual Int32 Log(EVerbosityLevel Verbosity, ELogColour TextColour, String Message) { try { Connection.Log(Verbosity, TextColour, Message); } catch (Exception) { } return Constants.SUCCESS; }