public MqttBrokerStart() { CrestronLogger.Mode = LoggerModeEnum.DEFAULT; CrestronLogger.PrintTheLog(true); CrestronLogger.Initialize(10); CrestronLogger.LogOnlyCurrentDebugLevel = false; }
/////////////////////////////// // //Read from file // /////////////////////////////// public static void ReadData() { CrestronLogger.Initialize(5, LoggerModeEnum.DEFAULT); char[] delimiterChars = { ',' }; List <string> DataLines = new List <string>(); if (File.Exists(FilePath)) { using (StreamReader SR = new StreamReader(FilePath))//Create Streamwriter { while (SR.EndOfStream != true) { DataLines.Add(SR.ReadLine()); } int z = 0; foreach (string i in DataLines) { string[] line = i.Split(delimiterChars); Users.Add(new user(line[0], line[1], Convert.ToUInt16(line[2]))); UserNames[z] = line[0]; z++; } CrestronLogger.WriteToLog("User data loaded.", 2); SR.Close(); } SendUIUpdate(); } FileRead = 1; }
public CrestronLoggerTraceListener() : base("CrestronLogger") { if (!CrestronLogger.LoggerInitialized) { CrestronLogger.Initialize(1); } }
/// <summary> /// Set the value of the CrestronLogger.PrintTheLog to true or false. /// </summary> /// <param name="val"> val = 0 equal false , val = 1 equals true</param> public void Log(ushort val) { bool printTheLog = val == 0 ? false : true; CrestronLogger.PrintTheLog(printTheLog); if (!printTheLog) { CrestronLogger.ShutdownLogger(); } else if (!CrestronLogger.LoggerInitialized) { CrestronLogger.Initialize(10); CrestronLogger.LogOnlyCurrentDebugLevel = false; } }
static Debug() { // Get the assembly version and print it to console and the log var version = Assembly.GetExecutingAssembly().GetName().Version; PepperDashCoreVersion = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision); var msg = string.Format("[App {0}] Using PepperDash_Core v{1}", InitialParametersClass.ApplicationNumber, PepperDashCoreVersion); CrestronConsole.PrintLine(msg); LogError(ErrorLogLevel.Notice, msg); IncludedExcludedKeys = new Dictionary <string, object>(); //CrestronDataStoreStatic.InitCrestronDataStore(); if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro) { // Add command to console CrestronConsole.AddNewConsoleCommand(SetDoNotLoadOnNextBootFromConsole, "donotloadonnextboot", "donotloadonnextboot:P [true/false]: Should the application load on next boot", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug", "appdebug:P [0-2]: Sets the application's console debug message level", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(ShowDebugLog, "appdebuglog", "appdebuglog:P [all] Use \"all\" for full log.", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => CrestronLogger.Clear(false), "appdebugclear", "appdebugclear:P Clears the current custom log", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SetDebugFilterFromConsole, "appdebugfilter", "appdebugfilter [params]", ConsoleAccessLevelEnum.AccessOperator); } CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler; LoadMemory(); var context = Contexts.GetOrCreateItem("DEFAULT"); Level = context.Level; DoNotLoadOnNextBoot = context.DoNotLoadOnNextBoot; if (DoNotLoadOnNextBoot) { CrestronConsole.PrintLine(string.Format("Program {0} will not load config after next boot. Use console command go:{0} to load the config manually", InitialParametersClass.ApplicationNumber)); } try { if (InitialParametersClass.NumberOfRemovableDrives > 0) { CrestronConsole.PrintLine("{0} RM Drive(s) Present.", InitialParametersClass.NumberOfRemovableDrives); CrestronLogger.Initialize(2, LoggerModeEnum.DEFAULT); // Use RM instead of DEFAULT as not to double-up console messages. } else { CrestronConsole.PrintLine("No RM Drive(s) Present."); } } catch (Exception e) { CrestronConsole.PrintLine("Initializing of CrestronLogger failed: {0}", e); } }
static Debug() { CrestronLogger.Initialize(1, false, LoggerModeEnum.DEFAULT); }