public void Error <T>(T valueObject, string user, string message, Exception exception, LogAppender logAppender, bool canNotify = false) where T : class { bool canAppendWithSQL = logAppender == LogAppender.all || logAppender == LogAppender.sql; bool canAppendWithFILE = logAppender == LogAppender.all || logAppender == LogAppender.file; Action <ILogBase> log = x => x.Error(valueObject, user, message, exception); try { if (canAppendWithSQL) { log.Invoke(LogDB.GetLog(DbConnection)); } if (canAppendWithFILE) { if (string.IsNullOrEmpty(LoggingPathFile)) { throw new Exception("file path is empty."); } log.Invoke(LogFile.GetLog(LoggingPathFile)); } } catch (Exception) { throw; } }
/* * * Log Data Format * * { * "PlayerID" : "UserID", * "CreationTimeStamp" : "TimeStamp", * "ScenariosIncluded":[ * { * "SceneName":"Scene1 name", * "SceneCode" : "SC1", * "SceneFileToLoad":"Scenefile name" * } * * ], * "ScenariosAttemted":{ * "SC1":true, * "SC2":true * }, * "SC1":{ * "GettingToKnowYourClass":{ * "start1":"3434343", * "end1":"3434343" * }, * "InitialSituation":{ * "start2":"3434343", * "end2":"3434343" * }, * "TeacherActions": * { * "total":1, * "TASData":[ * { * "TeacherActionSelected": "1", * "TASQuestion": "SLHSJHFKJSF", * "TASTimeStarted": "45454", * "TASTimeFinished": "45454", * "TASComment": "dfgfdgfg", * "TASMCQSelected": "DFFRD", * "Revision" : "0" * } * ] * }, * "PlayerActions": * { * "IntroPopupWindowShownAt" : "434353", * "IntroPopupWindowAcceptedAt" : "434353", * "LookingAt" : [ * { * "Target" : "Object Name", * "Time" : "34343", * "CurrentCell" : "CellNumber", * "CurrentActualPos" : {"x":1.0,"y":2.0,"z":3.0} * "CurrentActualLookingDirection" : {"x":1.0,"y":2.0,"z":3.0} * } * ], * "MovedTo" : [ * { * "FromCell" : "Cell Name", * "CurrentCell" : "CellNumber", * "Time" : "34343", * "CurrentActualPos" : {"x":1.0,"y":2.0,"z":3.0} * } * ], * * "SelectedStudent" : [ * { * "SelectionID": 1, * "StudentName" : "Name", * "TimeStamp" : "34343", * "Duration" : "34343", * "Phase" : "MA-I" * } * ] * } * "StudentSetup": [ * { * "StudentName" : "Name", * "Chair" : "ChairNumber", * "Desk" : "DeskNumber", * "CubbyBox" : "TableNumber", * "NeighbourStudent":"Student Name" * } * ] * "StudentActions": * { * "LookingAt" : [ * { * "StudentName" : "Name", * "Target" : "Object Name", * "Time" : "34343", * "CurrentCell" : "CellNumber" * "CurrentActualPos" : {"x":1.0,"y":2.0,"z":3.0} * } * ], * "Animations" : [ * { * "StudentName" : "Name", * "AnimationName" : " Name", * "Time" : "34343", * "CurrentCell" : "CellNumber" * } * ] * } * } * * } * * * * * */ private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } // Do not destroy this object, when we load a new scene. DontDestroyOnLoad(gameObject); if (LogData == null) { Init(); } //validIDs = PopulateNewIDs(212101, 212140); for (int i = 312101; i <= 312200; i++) { updatedValidIDs.Add(i); } for (int i = 612101; i <= 612200; i++) { updatedValidIDs.Add(i); } }
public void Info(string user, string message, LogAppender logAppender, bool canNotify = false) { bool canAppendWithSQL = logAppender == LogAppender.all || logAppender == LogAppender.sql; bool canAppendWithFILE = logAppender == LogAppender.all || logAppender == LogAppender.file; Action <ILogBase> log = x => x.Info(user, message); try { if (canAppendWithSQL) { log.Invoke(LogDB.GetLog(DbConnection)); } if (canAppendWithFILE) { if (string.IsNullOrEmpty(LoggingPathFile)) { throw new Exception("file path is empty."); } LogFile.GetLog(LoggingPathFile).Info(user, message); } } catch (Exception ex) { throw ex; } }
public override global::System.Data.DataSet Clone() { LogDB cln = ((LogDB)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public static bool Delete(Log MyLog) { if (MyLog != null) { return(LogDB.Delete(MyLog.id)); } else { return(false); } }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { LogDB ds = new LogDB(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public async Task <IActionResult> Index() { /// get lab lists here. List <LabListModel> labLists = await LabDB.GetListAsync(); /// get item transaction log here. List <Log> logLists = await LogDB.GetAllAsync(); logLists.Sort((x, y) => DateTime.Compare(y.created, x.created)); ViewData["LabLists"] = labLists; ViewData["LogLists"] = logLists; return(View()); }
private void Convert() { string value = inputTextbox.Text; string unitFrom = UnitFromCombobox.Text; string unitTo = UnitToCombobox.Text; string result = ((IConverter)convertersCombobox.SelectedItem).Convert(RemoveWhiteSpace(value), unitFrom, unitTo); LogDB.AddToDB(((IConverter)convertersCombobox.SelectedItem).Name.ToString(), unitFrom, unitTo, RemoveWhiteSpace(value), result); resultTextbox.Text = result; if (((IConverter)convertersCombobox.SelectedItem).Name == "Format Czasu") { SetClock(result, unitFrom); } }
public async Task <IActionResult> Blacklist() { /// get item transaction log here. List <Log> logLists = await LogDB.GetAllAsync(); logLists.Sort((x, y) => DateTime.Compare(y.created, x.created)); /// get all borrowed items list. List <Transaction> blacklistLists = await TransactionDB.GetAllAsync(); blacklistLists.Sort((x, y) => DateTime.Compare(x.book_date, y.book_date)); ViewData["LogLists"] = logLists; ViewData["BlacklistLists"] = blacklistLists; return(View()); }
protected void btnInsert_Click(object sender, EventArgs e) { var pizza = new Pizza() { Descricao = txtDesc.Text, Valor = decimal.Parse(txtValor.Text) }; var logDB = new LogDB(); if (new PizzaDB().Insert(pizza)) { logDB.Insert("Inserido com sucesso"); lblMSG.Text = "Top"; } else { logDB.Insert("Elemento não inserido"); } PopulaTabelaPizza(); PopulaTabelaLog(); }
public void WriteTest() { LogInterface.LogMessage log = new LogInterface.LogMessage(); log.Date = DateTime.Now; log.Event = "Test"; log.Ip = "127.0.0.1"; log.Level = "test"; log.Message = "测试消息"; log.Recorder = "testRecorder"; log.Thread = ""; var b = LogDB.Write(log); Assert.IsTrue(b); // LogDB.CreateSubmeterTable("submeter" + UnitTestDBAccess.Util.GenRandStr(5)); b = LogDB.Write("test", "", "127.0.0.1", "test recorder", "error", "123412312423423", DateTime.Now); Assert.IsTrue(b); b = LogDB.Write("test", "", "127.0.0.1", "test recorder", "error", "123412312423423", DateTime.Now.ToString()); Assert.IsTrue(b); var l = LogDB.GetLogs("test", "test recorder", "error", DateTime.Now.AddDays(-1).ToString(), DateTime.Now.AddDays(1).ToString()); Assert.IsTrue(l.Count >= 2); }
public static bool Delete(int id) { return(LogDB.Delete(id)); }
public LogExporter(LogDB DB, LogExportType type, StreamWriter writer) { this.DB = DB ?? throw new ArgumentNullException("DB"); this.w = writer ?? throw new ArgumentNullException("writer"); this.exportType = type; }
public static Log Insert(Log myItem) { return(LogDB.Insert(myItem)); }
public static Log Update(Log myItem) { return(LogDB.Update(myItem)); }
public static long Save(Log myLog) { return(LogDB.Save(myLog)); }
public static List <Log> FindAll() { return(LogDB.FindAll()); }
public void Dispose() { JobDB.Close(); LogDB.Close(); }
public DataTable ReadLog() { var dt = new LogDB().Read(); return(dt); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); LogDB ds = new LogDB(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "LogDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public static List <Log> FindFavoris(int idUtilisateur) { return(LogDB.FindFavoris(idUtilisateur)); }
/// <summary> /// Deletes all log entries from the database /// </summary> /// <returns> /// Returns nothing /// </returns> public static void DeleteAll() { LogDB.DeleteAll(); }
/// <summary> /// Returns the total number of log entries in the database /// </summary> /// <param name="StartRow"> /// The start position in the result set to retrieve records from /// </param> /// <param name="PageSize"> /// The maximum number of records to retrieve from position StartRow /// </param> /// <returns> /// Returns the total number of log entries in the database /// </returns> public static int Count(int StartRow, int PageSize) { return(LogDB.Count(StartRow, PageSize)); }
public static Log GetItem(long id) { return(LogDB.GetItem(id)); }
public Logger(string path) { DB = new LogDB(path); }
private void LoadEvents(string sampleDataPath, TimeSpan offset) { var files = System.IO.Directory.GetFiles(sampleDataPath, "events-*.json"); var evts = new List <BlackMaple.MachineWatchInterface.LogEntry>(); foreach (var f in files) { using (var file = System.IO.File.OpenRead(f)) { var reader = new System.IO.StreamReader(file); while (reader.Peek() >= 0) { var evtJson = reader.ReadLine(); var e = (BlackMaple.MachineWatchInterface.LogEntry)JsonConvert.DeserializeObject( evtJson, typeof(BlackMaple.MachineWatchInterface.LogEntry), _jsonSettings ); evts.Add(e); } } } foreach (var e in evts.OrderBy(e => e.EndTimeUTC)) { foreach (var m in e.Material) { var matDetails = LogDB.GetMaterialDetails(m.MaterialID); if (matDetails == null && !string.IsNullOrEmpty(m.JobUniqueStr)) { LogDB.CreateMaterialID(m.MaterialID, m.JobUniqueStr, m.PartName, m.NumProcesses); } } if (e.LogType == LogType.PartMark) { foreach (var m in e.Material) { LogDB.RecordSerialForMaterialID(JobLogDB.EventLogMaterial.FromLogMat(m), e.Result, e.EndTimeUTC.Add(offset)); } } else if (e.LogType == LogType.OrderAssignment) { foreach (var m in e.Material) { LogDB.RecordWorkorderForMaterialID(JobLogDB.EventLogMaterial.FromLogMat(m), e.Result, e.EndTimeUTC.Add(offset)); } } else if (e.LogType == LogType.FinalizeWorkorder) { LogDB.RecordFinalizedWorkorder(e.Result, e.EndTimeUTC.Add(offset)); } else { if (e.LogType == LogType.InspectionResult && e.Material.Any(m => m.MaterialID == 2965)) { // ignore inspection complete continue; } var e2 = new BlackMaple.MachineWatchInterface.LogEntry( cntr: e.Counter, mat: e.Material, pal: e.Pallet, ty: e.LogType, locName: e.LocationName, locNum: e.LocationNum, prog: e.Program, start: e.StartOfCycle, endTime: e.EndTimeUTC.Add(offset), result: e.Result, endOfRoute: e.EndOfRoute, elapsed: e.ElapsedTime, active: e.ActiveOperationTime ); if (e.ProgramDetails != null) { foreach (var x in e.ProgramDetails) { e2.ProgramDetails.Add(x.Key, x.Value); } } if (e.Tools != null) { foreach (var x in e.Tools) { e2.Tools[x.Key] = x.Value; } } LogDB.AddLogEntryFromUnitTest(e2); } } }
public static List <Log> FindAll(int idProjet) { return(LogDB.FindAll(idProjet)); }
public static Log Load(int id) { return(LogDB.Load(id)); }
public Proxy(LogDB logDB) { this._logDB = logDB; }
public static List <Log> GetList(int StartRow, int PageSize) { return(LogDB.GetList(StartRow, PageSize)); }