Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Log.cs
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4using System.Text;
5
6namespace Waher.Events
7{
12 public static class Log
13 {
14 private static Type[] alertExceptionTypes = new Type[0];
15 private static bool alertExceptionTypesLocked = false;
16 private static IEventSink[] staticSinks = new IEventSink[0];
17 private readonly static List<IEventSink> dynamicSinks = new List<IEventSink>();
18 private static Type[] nestedExceptionTypes = new Type[]
19 {
20 typeof(TargetInvocationException),
21 typeof(TypeInitializationException)
22 };
23
29 public static void Register(IEventSink EventSink)
30 {
31 if (!(EventSink is null))
32 {
33 lock (dynamicSinks)
34 {
35 dynamicSinks.Add(EventSink);
36 staticSinks = dynamicSinks.ToArray();
37 }
38 }
39 }
40
46 public static bool Unregister(IEventSink EventSink)
47 {
48 if (!(EventSink is null))
49 {
50 lock (dynamicSinks)
51 {
52 if (dynamicSinks.Remove(EventSink))
53 {
54 staticSinks = dynamicSinks.ToArray();
55 return true;
56 }
57 }
58 }
59
60 return false;
61 }
62
67 public static bool RegisterExceptionToUnnest(Type ExceptionType)
68 {
69 if (!typeof(Exception).GetTypeInfo().IsAssignableFrom(ExceptionType.GetTypeInfo()))
70 return false;
71
72 lock (dynamicSinks)
73 {
74 if (Array.IndexOf(nestedExceptionTypes, ExceptionType) >= 0)
75 return false;
76
77 int c = nestedExceptionTypes.Length;
78 Type[] Result = new Type[c + 1];
79 Array.Copy(nestedExceptionTypes, 0, Result, 0, c);
80 Result[c] = ExceptionType;
81 nestedExceptionTypes = Result;
82 }
83
84 return true;
85 }
86
90 public static void Terminate()
91 {
92 foreach (IEventSink Sink in Sinks)
93 {
94 Unregister(Sink);
95
96 if (Sink is IDisposable Disposable)
97 {
98 try
99 {
100 Disposable.Dispose();
101 }
102 catch (Exception)
103 {
104 // Ignore.
105 }
106 }
107 }
108
109 EventHandler h = Terminating;
110 if (!(h is null))
111 h(null, EventArgs.Empty);
112 }
113
117 public static event EventHandler Terminating = null;
118
122 public static IEventSink[] Sinks => staticSinks;
123
128 public static async void Event(Event Event)
129 {
130 foreach (IEventSink EventSink in staticSinks)
131 {
133 {
134 try
135 {
136 await EventSink.Queue(Event);
137
138 if (hasReportedErrors)
139 {
140 lock (reportedErrors)
141 {
142 if (reportedErrors.Remove(EventSink))
143 hasReportedErrors = reportedErrors.Count > 0;
144 }
145 }
146 }
147 catch (Exception ex)
148 {
149 lock (reportedErrors)
150 {
151 if (reportedErrors.TryGetValue(EventSink, out bool b) && b)
152 continue;
153
154 reportedErrors[EventSink] = true;
155 hasReportedErrors = true;
156 }
157
158 Event Event2 = new Event(DateTime.Now, EventType.Critical, ex.Message, EventSink.ObjectID, string.Empty, string.Empty,
159 EventLevel.Major, string.Empty, ex.Source, CleanStackTrace(ex.StackTrace));
160
161 if (!(Event.ToAvoid is null))
162 {
163 foreach (IEventSink EventSink2 in Event.ToAvoid)
164 Event2.Avoid(EventSink2);
165 }
166
167 Event2.Avoid(EventSink);
168
169 Log.Event(Event2);
170 }
171 }
172 }
173 }
174
175 private readonly static Dictionary<IEventSink, bool> reportedErrors = new Dictionary<IEventSink, bool>();
176 private static bool hasReportedErrors = false;
177 private static readonly char[] crlf = new char[] { '\r', '\n' };
178
184 public static string CleanStackTrace(string StackTrace)
185 {
186 if (string.IsNullOrEmpty(StackTrace))
187 return StackTrace;
188 else
189 {
190 StringBuilder Result = new StringBuilder();
191
192 foreach (string Row in StackTrace.Split(crlf, StringSplitOptions.RemoveEmptyEntries))
193 {
194 if (Row.StartsWith(" at System.") || (Row.StartsWith("--- ") && Row.EndsWith(" ---")))
195 continue;
196
197 Result.AppendLine(Row);
198 }
199
200 return Result.ToString();
201 }
202 }
203
204 #region Debug
205
218 public static void Debug(string Message, string Object, string Actor, string EventId, EventLevel Level,
219 string Facility, string Module, string StackTrace, params KeyValuePair<string, object>[] Tags)
220 {
221 Event(new Event(EventType.Debug, Message, Object, Actor, EventId, Level, Facility, Module, StackTrace, Tags));
222 }
223
235 public static void Debug(string Message, string Object, string Actor, string EventId, EventLevel Level,
236 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
237 {
238 Event(new Event(EventType.Debug, Message, Object, Actor, EventId, Level, Facility, Module, string.Empty, Tags));
239 }
240
251 public static void Debug(string Message, string Object, string Actor, string EventId, EventLevel Level,
252 string Facility, params KeyValuePair<string, object>[] Tags)
253 {
254 Event(new Event(EventType.Debug, Message, Object, Actor, EventId, Level, Facility, string.Empty, string.Empty, Tags));
255 }
256
266 public static void Debug(string Message, string Object, string Actor, string EventId, EventLevel Level,
267 params KeyValuePair<string, object>[] Tags)
268 {
269 Event(new Event(EventType.Debug, Message, Object, Actor, EventId, Level, string.Empty, string.Empty, string.Empty, Tags));
270 }
271
280 public static void Debug(string Message, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
281 {
282 Event(new Event(EventType.Debug, Message, Object, Actor, EventId, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
283 }
284
292 public static void Debug(string Message, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
293 {
294 Event(new Event(EventType.Debug, Message, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
295 }
296
303 public static void Debug(string Message, string Object, params KeyValuePair<string, object>[] Tags)
304 {
305 Event(new Event(EventType.Debug, Message, Object, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
306 }
307
313 public static void Debug(string Message, params KeyValuePair<string, object>[] Tags)
314 {
315 Event(new Event(EventType.Debug, Message, string.Empty, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
316 }
317
318 #endregion
319
320 #region Informational
321
334 public static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level,
335 string Facility, string Module, string StackTrace, params KeyValuePair<string, object>[] Tags)
336 {
337 Event(new Event(EventType.Informational, Message, Object, Actor, EventId, Level, Facility, Module, StackTrace, Tags));
338 }
339
351 public static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level,
352 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
353 {
354 Event(new Event(EventType.Informational, Message, Object, Actor, EventId, Level, Facility, Module, string.Empty, Tags));
355 }
356
367 public static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level,
368 string Facility, params KeyValuePair<string, object>[] Tags)
369 {
370 Event(new Event(EventType.Informational, Message, Object, Actor, EventId, Level, Facility, string.Empty, string.Empty, Tags));
371 }
372
382 public static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level,
383 params KeyValuePair<string, object>[] Tags)
384 {
385 Event(new Event(EventType.Informational, Message, Object, Actor, EventId, Level, string.Empty, string.Empty, string.Empty, Tags));
386 }
387
396 public static void Informational(string Message, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
397 {
398 Event(new Event(EventType.Informational, Message, Object, Actor, EventId, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
399 }
400
408 public static void Informational(string Message, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
409 {
410 Event(new Event(EventType.Informational, Message, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
411 }
412
419 public static void Informational(string Message, string Object, params KeyValuePair<string, object>[] Tags)
420 {
421 Event(new Event(EventType.Informational, Message, Object, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
422 }
423
429 public static void Informational(string Message, params KeyValuePair<string, object>[] Tags)
430 {
431 Event(new Event(EventType.Informational, Message, string.Empty, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
432 }
433
434 #endregion
435
436 #region Notice
437
450 public static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level,
451 string Facility, string Module, string StackTrace, params KeyValuePair<string, object>[] Tags)
452 {
453 Event(new Event(EventType.Notice, Message, Object, Actor, EventId, Level, Facility, Module, StackTrace, Tags));
454 }
455
467 public static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level,
468 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
469 {
470 Event(new Event(EventType.Notice, Message, Object, Actor, EventId, Level, Facility, Module, string.Empty, Tags));
471 }
472
483 public static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level,
484 string Facility, params KeyValuePair<string, object>[] Tags)
485 {
486 Event(new Event(EventType.Notice, Message, Object, Actor, EventId, Level, Facility, string.Empty, string.Empty, Tags));
487 }
488
498 public static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level,
499 params KeyValuePair<string, object>[] Tags)
500 {
501 Event(new Event(EventType.Notice, Message, Object, Actor, EventId, Level, string.Empty, string.Empty, string.Empty, Tags));
502 }
503
512 public static void Notice(string Message, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
513 {
514 Event(new Event(EventType.Notice, Message, Object, Actor, EventId, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
515 }
516
524 public static void Notice(string Message, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
525 {
526 Event(new Event(EventType.Notice, Message, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
527 }
528
535 public static void Notice(string Message, string Object, params KeyValuePair<string, object>[] Tags)
536 {
537 Event(new Event(EventType.Notice, Message, Object, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
538 }
539
545 public static void Notice(string Message, params KeyValuePair<string, object>[] Tags)
546 {
547 Event(new Event(EventType.Notice, Message, string.Empty, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
548 }
549
550 #endregion
551
552 #region Warning
553
566 public static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level,
567 string Facility, string Module, string StackTrace, params KeyValuePair<string, object>[] Tags)
568 {
569 Event(new Event(EventType.Warning, Message, Object, Actor, EventId, Level, Facility, Module, StackTrace, Tags));
570 }
571
583 public static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level,
584 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
585 {
586 Event(new Event(EventType.Warning, Message, Object, Actor, EventId, Level, Facility, Module, string.Empty, Tags));
587 }
588
599 public static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level,
600 string Facility, params KeyValuePair<string, object>[] Tags)
601 {
602 Event(new Event(EventType.Warning, Message, Object, Actor, EventId, Level, Facility, string.Empty, string.Empty, Tags));
603 }
604
614 public static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level,
615 params KeyValuePair<string, object>[] Tags)
616 {
617 Event(new Event(EventType.Warning, Message, Object, Actor, EventId, Level, string.Empty, string.Empty, string.Empty, Tags));
618 }
619
628 public static void Warning(string Message, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
629 {
630 Event(new Event(EventType.Warning, Message, Object, Actor, EventId, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
631 }
632
640 public static void Warning(string Message, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
641 {
642 Event(new Event(EventType.Warning, Message, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
643 }
644
651 public static void Warning(string Message, string Object, params KeyValuePair<string, object>[] Tags)
652 {
653 Event(new Event(EventType.Warning, Message, Object, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
654 }
655
661 public static void Warning(string Message, params KeyValuePair<string, object>[] Tags)
662 {
663 Event(new Event(EventType.Warning, Message, string.Empty, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
664 }
665
666 #endregion
667
668 #region Error
669
682 public static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level,
683 string Facility, string Module, string StackTrace, params KeyValuePair<string, object>[] Tags)
684 {
685 Event(new Event(EventType.Error, Message, Object, Actor, EventId, Level, Facility, Module, StackTrace, Tags));
686 }
687
699 public static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level,
700 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
701 {
702 Event(new Event(EventType.Error, Message, Object, Actor, EventId, Level, Facility, Module, string.Empty, Tags));
703 }
704
715 public static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level,
716 string Facility, params KeyValuePair<string, object>[] Tags)
717 {
718 Event(new Event(EventType.Error, Message, Object, Actor, EventId, Level, Facility, string.Empty, string.Empty, Tags));
719 }
720
730 public static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level,
731 params KeyValuePair<string, object>[] Tags)
732 {
733 Event(new Event(EventType.Error, Message, Object, Actor, EventId, Level, string.Empty, string.Empty, string.Empty, Tags));
734 }
735
744 public static void Error(string Message, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
745 {
746 Event(new Event(EventType.Error, Message, Object, Actor, EventId, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
747 }
748
756 public static void Error(string Message, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
757 {
758 Event(new Event(EventType.Error, Message, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
759 }
760
767 public static void Error(string Message, string Object, params KeyValuePair<string, object>[] Tags)
768 {
769 Event(new Event(EventType.Error, Message, Object, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
770 }
771
777 public static void Error(string Message, params KeyValuePair<string, object>[] Tags)
778 {
779 Event(new Event(EventType.Error, Message, string.Empty, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
780 }
781
793 public static void Error(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
794 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
795 {
796 Event(EventType.Error, Exception, Object, Actor, EventId, Level, Facility, Module, Tags);
797 }
798
799 private static void Event(EventType Type, Exception Exception, string Object, string Actor, string EventId,
800 EventLevel Level, string Facility, string Module, params KeyValuePair<string, object>[] Tags)
801 {
802 Exception = UnnestException(Exception);
803
804 if (Exception is AggregateException ex)
805 {
806 foreach (Exception ex2 in ex.InnerExceptions)
807 Event(Type, ex2, Object, Actor, EventId, Level, Facility, Module, Tags);
808 }
809 else
810 Event(new Event(Type, Exception, Object, Actor, EventId, Level, Facility, Module, Tags));
811 }
812
818 public static Exception UnnestException(Exception Exception)
819 {
820 while (!(Exception?.InnerException is null))
821 {
822 Type T = Exception.GetType();
823 if (Array.IndexOf(nestedExceptionTypes, T) < 0)
824 {
825 if (Exception is AggregateException AggregateException &&
826 AggregateException.InnerExceptions.Count == 1)
827 {
828 Exception = AggregateException.InnerExceptions[0];
829 continue;
830 }
831
832 break;
833 }
834
835 Exception = Exception.InnerException;
836 }
837
838 return Exception;
839 }
840
851 public static void Error(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
852 string Facility, params KeyValuePair<string, object>[] Tags)
853 {
854 Event(EventType.Error, Exception, Object, Actor, EventId, Level, Facility, Tags);
855 }
856
857 private static void Event(EventType Type, Exception Exception, string Object, string Actor, string EventId,
858 EventLevel Level, string Facility, params KeyValuePair<string, object>[] Tags)
859 {
860 Exception = UnnestException(Exception);
861
862 if (Exception is AggregateException ex)
863 {
864 foreach (Exception ex2 in ex.InnerExceptions)
865 Event(Type, ex2, Object, Actor, EventId, Level, Facility, Tags);
866 }
867 else
868 Event(new Event(Type, Exception, Object, Actor, EventId, Level, Facility, Exception.Source, Tags));
869 }
870
880 public static void Error(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
881 params KeyValuePair<string, object>[] Tags)
882 {
883 Event(EventType.Error, Exception, Object, Actor, EventId, Level, Tags);
884 }
885
886 private static void Event(EventType Type, Exception Exception, string Object, string Actor, string EventId,
887 EventLevel Level, params KeyValuePair<string, object>[] Tags)
888 {
889 Exception = UnnestException(Exception);
890
891 if (Exception is AggregateException ex)
892 {
893 foreach (Exception ex2 in ex.InnerExceptions)
894 Event(Type, ex2, Object, Actor, EventId, Level, Tags);
895 }
896 else
897 Event(new Event(Type, Exception, Object, Actor, EventId, Level, string.Empty, Exception.Source, Tags));
898 }
899
908 public static void Error(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
909 {
910 Event(EventType.Error, Exception, Object, Actor, EventId, Tags);
911 }
912
913 private static void Event(EventType Type, Exception Exception, string Object, string Actor, string EventId,
914 params KeyValuePair<string, object>[] Tags)
915 {
916 Exception = UnnestException(Exception);
917
918 if (Exception is AggregateException ex)
919 {
920 foreach (Exception ex2 in ex.InnerExceptions)
921 Event(Type, ex2, Object, Actor, EventId, Tags);
922 }
923 else
924 Event(new Event(Type, Exception, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, Exception.Source, Tags));
925 }
926
934 public static void Error(Exception Exception, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
935 {
936 Event(EventType.Error, Exception, Object, Actor, Tags);
937 }
938
939 private static void Event(EventType Type, Exception Exception, string Object, string Actor,
940 params KeyValuePair<string, object>[] Tags)
941 {
942 Exception = UnnestException(Exception);
943
944 if (Exception is AggregateException ex)
945 {
946 foreach (Exception ex2 in ex.InnerExceptions)
947 Event(Type, ex2, Object, Actor, Tags);
948 }
949 else
950 Event(new Event(Type, Exception, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, Exception.Source, Tags));
951 }
952
959 public static void Error(Exception Exception, string Object, params KeyValuePair<string, object>[] Tags)
960 {
961 Event(EventType.Error, Exception, Object, Tags);
962 }
963
964 private static void Event(EventType Type, Exception Exception, string Object,
965 params KeyValuePair<string, object>[] Tags)
966 {
967 Exception = UnnestException(Exception);
968
969 if (Exception is AggregateException ex)
970 {
971 foreach (Exception ex2 in ex.InnerExceptions)
972 Event(Type, ex2, Object, Tags);
973 }
974 else
975 Event(new Event(Type, Exception, Object, string.Empty, string.Empty, EventLevel.Minor, string.Empty, Exception.Source, Tags));
976 }
977
983 public static void Error(Exception Exception, params KeyValuePair<string, object>[] Tags)
984 {
985 Event(EventType.Error, Exception, Tags);
986 }
987
988 private static void Event(EventType Type, Exception Exception, params KeyValuePair<string, object>[] Tags)
989 {
990 Exception = UnnestException(Exception);
991
992 if (Exception is AggregateException ex)
993 {
994 foreach (Exception ex2 in ex.InnerExceptions)
995 Event(Type, ex2, Tags);
996 }
997 else
998 Event(new Event(Type, Exception, string.Empty, string.Empty, string.Empty, EventLevel.Minor, string.Empty, Exception.Source, Tags));
999 }
1000
1001 #endregion
1002
1003 #region Critical
1004
1017 public static void Critical(string Message, string Object, string Actor, string EventId, EventLevel Level,
1018 string Facility, string Module, string StackTrace, params KeyValuePair<string, object>[] Tags)
1019 {
1020 Event(new Event(EventType.Critical, Message, Object, Actor, EventId, Level, Facility, Module, StackTrace, Tags));
1021 }
1022
1034 public static void Critical(string Message, string Object, string Actor, string EventId, EventLevel Level,
1035 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
1036 {
1037 Event(new Event(EventType.Critical, Message, Object, Actor, EventId, Level, Facility, Module, string.Empty, Tags));
1038 }
1039
1050 public static void Critical(string Message, string Object, string Actor, string EventId, EventLevel Level,
1051 string Facility, params KeyValuePair<string, object>[] Tags)
1052 {
1053 Event(new Event(EventType.Critical, Message, Object, Actor, EventId, Level, Facility, string.Empty, string.Empty, Tags));
1054 }
1055
1065 public static void Critical(string Message, string Object, string Actor, string EventId, EventLevel Level,
1066 params KeyValuePair<string, object>[] Tags)
1067 {
1068 Event(new Event(EventType.Critical, Message, Object, Actor, EventId, Level, string.Empty, string.Empty, string.Empty, Tags));
1069 }
1070
1079 public static void Critical(string Message, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
1080 {
1081 Event(new Event(EventType.Critical, Message, Object, Actor, EventId, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1082 }
1083
1091 public static void Critical(string Message, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
1092 {
1093 Event(new Event(EventType.Critical, Message, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1094 }
1095
1102 public static void Critical(string Message, string Object, params KeyValuePair<string, object>[] Tags)
1103 {
1104 Event(new Event(EventType.Critical, Message, Object, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1105 }
1106
1112 public static void Critical(string Message, params KeyValuePair<string, object>[] Tags)
1113 {
1114 Event(new Event(EventType.Critical, Message, string.Empty, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1115 }
1116
1128 public static void Critical(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1129 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
1130 {
1131 Event(EventType.Critical, Exception, Object, Actor, EventId, Level, Facility, Module, Tags);
1132 }
1133
1144 public static void Critical(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1145 string Facility, params KeyValuePair<string, object>[] Tags)
1146 {
1147 Event(EventType.Critical, Exception, Object, Actor, EventId, Level, Facility, Tags);
1148 }
1149
1159 public static void Critical(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1160 params KeyValuePair<string, object>[] Tags)
1161 {
1162 Event(EventType.Critical, Exception, Object, Actor, EventId, Level, Tags);
1163 }
1164
1173 public static void Critical(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
1174 {
1175 Event(EventType.Critical, Exception, Object, Actor, EventId, Tags);
1176 }
1177
1185 public static void Critical(Exception Exception, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
1186 {
1187 Event(EventType.Critical, Exception, Object, Actor, Tags);
1188 }
1189
1196 public static void Critical(Exception Exception, string Object, params KeyValuePair<string, object>[] Tags)
1197 {
1198 Event(EventType.Critical, Exception, Object, Tags);
1199 }
1200
1206 public static void Critical(Exception Exception, params KeyValuePair<string, object>[] Tags)
1207 {
1208 Event(EventType.Critical, Exception, Tags);
1209 }
1210
1211 #endregion
1212
1213 #region Alert
1214
1227 public static void Alert(string Message, string Object, string Actor, string EventId, EventLevel Level,
1228 string Facility, string Module, string StackTrace, params KeyValuePair<string, object>[] Tags)
1229 {
1230 Event(new Event(EventType.Alert, Message, Object, Actor, EventId, Level, Facility, Module, StackTrace, Tags));
1231 }
1232
1244 public static void Alert(string Message, string Object, string Actor, string EventId, EventLevel Level,
1245 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
1246 {
1247 Event(new Event(EventType.Alert, Message, Object, Actor, EventId, Level, Facility, Module, string.Empty, Tags));
1248 }
1249
1260 public static void Alert(string Message, string Object, string Actor, string EventId, EventLevel Level,
1261 string Facility, params KeyValuePair<string, object>[] Tags)
1262 {
1263 Event(new Event(EventType.Alert, Message, Object, Actor, EventId, Level, Facility, string.Empty, string.Empty, Tags));
1264 }
1265
1275 public static void Alert(string Message, string Object, string Actor, string EventId, EventLevel Level,
1276 params KeyValuePair<string, object>[] Tags)
1277 {
1278 Event(new Event(EventType.Alert, Message, Object, Actor, EventId, Level, string.Empty, string.Empty, string.Empty, Tags));
1279 }
1280
1289 public static void Alert(string Message, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
1290 {
1291 Event(new Event(EventType.Alert, Message, Object, Actor, EventId, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1292 }
1293
1301 public static void Alert(string Message, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
1302 {
1303 Event(new Event(EventType.Alert, Message, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1304 }
1305
1312 public static void Alert(string Message, string Object, params KeyValuePair<string, object>[] Tags)
1313 {
1314 Event(new Event(EventType.Alert, Message, Object, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1315 }
1316
1322 public static void Alert(string Message, params KeyValuePair<string, object>[] Tags)
1323 {
1324 Event(new Event(EventType.Alert, Message, string.Empty, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1325 }
1326
1338 public static void Alert(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1339 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
1340 {
1341 Event(EventType.Alert, Exception, Object, Actor, EventId, Level, Facility, Module, Tags);
1342 }
1343
1354 public static void Alert(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1355 string Facility, params KeyValuePair<string, object>[] Tags)
1356 {
1357 Event(EventType.Alert, Exception, Object, Actor, EventId, Level, Facility, Tags);
1358 }
1359
1369 public static void Alert(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1370 params KeyValuePair<string, object>[] Tags)
1371 {
1372 Event(EventType.Alert, Exception, Object, Actor, EventId, Level, Tags);
1373 }
1374
1383 public static void Alert(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
1384 {
1385 Event(EventType.Alert, Exception, Object, Actor, EventId, Tags);
1386 }
1387
1395 public static void Alert(Exception Exception, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
1396 {
1397 Event(EventType.Alert, Exception, Object, Actor, Tags);
1398 }
1399
1406 public static void Alert(Exception Exception, string Object, params KeyValuePair<string, object>[] Tags)
1407 {
1408 Event(EventType.Alert, Exception, Object, Tags);
1409 }
1410
1416 public static void Alert(Exception Exception, params KeyValuePair<string, object>[] Tags)
1417 {
1418 Event(EventType.Alert, Exception, Tags);
1419 }
1420
1421 #endregion
1422
1423 #region Emergency
1424
1437 public static void Emergency(string Message, string Object, string Actor, string EventId, EventLevel Level,
1438 string Facility, string Module, string StackTrace, params KeyValuePair<string, object>[] Tags)
1439 {
1440 Event(new Event(EventType.Emergency, Message, Object, Actor, EventId, Level, Facility, Module, StackTrace, Tags));
1441 }
1442
1454 public static void Emergency(string Message, string Object, string Actor, string EventId, EventLevel Level,
1455 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
1456 {
1457 Event(new Event(EventType.Emergency, Message, Object, Actor, EventId, Level, Facility, Module, string.Empty, Tags));
1458 }
1459
1470 public static void Emergency(string Message, string Object, string Actor, string EventId, EventLevel Level,
1471 string Facility, params KeyValuePair<string, object>[] Tags)
1472 {
1473 Event(new Event(EventType.Emergency, Message, Object, Actor, EventId, Level, Facility, string.Empty, string.Empty, Tags));
1474 }
1475
1485 public static void Emergency(string Message, string Object, string Actor, string EventId, EventLevel Level,
1486 params KeyValuePair<string, object>[] Tags)
1487 {
1488 Event(new Event(EventType.Emergency, Message, Object, Actor, EventId, Level, string.Empty, string.Empty, string.Empty, Tags));
1489 }
1490
1499 public static void Emergency(string Message, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
1500 {
1501 Event(new Event(EventType.Emergency, Message, Object, Actor, EventId, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1502 }
1503
1511 public static void Emergency(string Message, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
1512 {
1513 Event(new Event(EventType.Emergency, Message, Object, Actor, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1514 }
1515
1522 public static void Emergency(string Message, string Object, params KeyValuePair<string, object>[] Tags)
1523 {
1524 Event(new Event(EventType.Emergency, Message, Object, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1525 }
1526
1532 public static void Emergency(string Message, params KeyValuePair<string, object>[] Tags)
1533 {
1534 Event(new Event(EventType.Emergency, Message, string.Empty, string.Empty, string.Empty, EventLevel.Minor, string.Empty, string.Empty, string.Empty, Tags));
1535 }
1536
1548 public static void Emergency(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1549 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
1550 {
1551 Event(EventType.Emergency, Exception, Object, Actor, EventId, Level, Facility, Module, Tags);
1552 }
1553
1564 public static void Emergency(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1565 string Facility, params KeyValuePair<string, object>[] Tags)
1566 {
1567 Event(EventType.Emergency, Exception, Object, Actor, EventId, Level, Facility, Tags);
1568 }
1569
1579 public static void Emergency(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1580 params KeyValuePair<string, object>[] Tags)
1581 {
1582 Event(EventType.Emergency, Exception, Object, Actor, EventId, Level, Tags);
1583 }
1584
1593 public static void Emergency(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
1594 {
1595 Event(EventType.Emergency, Exception, Object, Actor, EventId, Tags);
1596 }
1597
1605 public static void Emergency(Exception Exception, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
1606 {
1607 Event(EventType.Emergency, Exception, Object, Actor, Tags);
1608 }
1609
1616 public static void Emergency(Exception Exception, string Object, params KeyValuePair<string, object>[] Tags)
1617 {
1618 Event(EventType.Emergency, Exception, Object, Tags);
1619 }
1620
1626 public static void Emergency(Exception Exception, params KeyValuePair<string, object>[] Tags)
1627 {
1628 Event(EventType.Emergency, Exception, Tags);
1629 }
1630
1631 #endregion
1632
1633 #region Exceptions
1634
1635
1647 public static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1648 string Facility, string Module, params KeyValuePair<string, object>[] Tags)
1649 {
1650 Event(GetEventType(Exception), Exception, Object, Actor, EventId, Level, Facility, Module, Tags);
1651 }
1652
1663 public static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1664 string Facility, params KeyValuePair<string, object>[] Tags)
1665 {
1666 Event(GetEventType(Exception), Exception, Object, Actor, EventId, Level, Facility, Tags);
1667 }
1668
1678 public static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level,
1679 params KeyValuePair<string, object>[] Tags)
1680 {
1681 Event(GetEventType(Exception), Exception, Object, Actor, EventId, Level, Tags);
1682 }
1683
1692 public static void Exception(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair<string, object>[] Tags)
1693 {
1694 Event(GetEventType(Exception), Exception, Object, Actor, EventId, Tags);
1695 }
1696
1704 public static void Exception(Exception Exception, string Object, string Actor, params KeyValuePair<string, object>[] Tags)
1705 {
1706 Event(GetEventType(Exception), Exception, Object, Actor, Tags);
1707 }
1708
1715 public static void Exception(Exception Exception, string Object, params KeyValuePair<string, object>[] Tags)
1716 {
1717 Event(GetEventType(Exception), Exception, Object, Tags);
1718 }
1719
1725 public static void Exception(Exception Exception, params KeyValuePair<string, object>[] Tags)
1726 {
1727 Exception = UnnestException(Exception);
1728 Event(GetEventType(Exception), Exception, Tags);
1729 }
1730
1736 public static EventType GetEventType(Exception Exception)
1737 {
1738 if (Array.IndexOf(alertExceptionTypes, Exception.GetType()) >= 0)
1739 return EventType.Alert;
1740 else
1741 return EventType.Critical;
1742 }
1743
1751 public static void RegisterAlertExceptionType(bool Lock, params Type[] ExceptionTypes)
1752 {
1753 List<Type> NewTypes = new List<Type>();
1754 bool Changed = false;
1755
1756 NewTypes.AddRange(alertExceptionTypes);
1757
1758 foreach (Type ExceptionType in ExceptionTypes)
1759 {
1760 if (!NewTypes.Contains(ExceptionType))
1761 {
1762 if (alertExceptionTypesLocked)
1763 throw new InvalidOperationException("List of alert exception types has been locked.");
1764
1765 NewTypes.Add(ExceptionType);
1766 Changed = true;
1767 }
1768 }
1769
1770 if (Changed)
1771 alertExceptionTypes = NewTypes.ToArray();
1772
1773 alertExceptionTypesLocked = Lock;
1774 }
1775
1776 #endregion
1777
1778 #region Extensions
1779
1787 public static T[] Join<T>(this T[] Array, params T[] NewElements)
1788 {
1789 if (Array is null)
1790 return NewElements;
1791
1792 int c = Array.Length;
1793 if (c == 0)
1794 return NewElements;
1795
1796 if (NewElements is null)
1797 return Array;
1798
1799 int d = NewElements.Length;
1800 if (d == 0)
1801 return Array;
1802
1803 T[] Result = new T[c + d];
1804
1805 System.Array.Copy(Array, 0, Result, 0, c);
1806 System.Array.Copy(NewElements, 0, Result, c, d);
1807
1808 return Result;
1809 }
1810
1811 #endregion
1812 }
1813}
Class representing an event.
Definition: Event.cs:10
void Avoid(IEventSink EventSink)
If the event sink EventSink should be avoided when logging the event.
Definition: Event.cs:189
bool ShoudAvoid(IEventSink EventSink)
If the event sink EventSink should be avoided when logging the event.
Definition: Event.cs:179
Base class for event sinks.
Definition: EventSink.cs:9
abstract Task Queue(Event Event)
Queues an event to be output.
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:13
static void Debug(string Message, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs a debug event.
Definition: Log.cs:280
static void Alert(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1383
static void Alert(Exception Exception, string Object, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1406
static void Exception(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1692
static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Definition: Log.cs:467
static void Emergency(Exception Exception, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1626
static void Informational(string Message, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Definition: Log.cs:429
static void Emergency(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1564
static void Error(Exception Exception, string Object, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:959
static void Debug(string Message, string Object, params KeyValuePair< string, object >[] Tags)
Logs a debug event.
Definition: Log.cs:303
static void Terminate()
Must be called when the application is terminated. Stops all event sinks that have been registered.
Definition: Log.cs:90
static void Critical(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1159
static void RegisterAlertExceptionType(bool Lock, params Type[] ExceptionTypes)
Registers a set of Exception types as Exception types that should generate alert log entries when log...
Definition: Log.cs:1751
static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Definition: Log.cs:351
static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Definition: Log.cs:382
static void Error(string Message, string Object, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:767
static string CleanStackTrace(string StackTrace)
Cleans a Stack Trace string, removing entries from the asynchronous execution model,...
Definition: Log.cs:184
static void Critical(string Message, string Object, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1102
static void Emergency(string Message, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1532
static void Alert(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1244
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1663
static void Emergency(Exception Exception, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1605
static IEventSink[] Sinks
Registered sinks.
Definition: Log.cs:122
static void Alert(string Message, string Object, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1312
static void Informational(string Message, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Definition: Log.cs:408
static void Warning(string Message, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Definition: Log.cs:640
static void Warning(string Message, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Definition: Log.cs:661
static void Error(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:880
static EventHandler Terminating
Event raised when the application is terminating.
Definition: Log.cs:117
static void Alert(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1338
static void Alert(string Message, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1275
static void Alert(Exception Exception, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1395
static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Definition: Log.cs:498
static void Critical(string Message, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1112
static void Notice(string Message, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Definition: Log.cs:545
static bool RegisterExceptionToUnnest(Type ExceptionType)
Register an exception type to unnest in logging. By default, only the TargetInvocationException is un...
Definition: Log.cs:67
static void Alert(string Message, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1301
static void Emergency(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1579
static void Emergency(string Message, string Object, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1522
static void Notice(string Message, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Definition: Log.cs:524
static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Definition: Log.cs:583
static void Emergency(string Message, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1499
static void Critical(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1173
static void Emergency(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1470
static void Emergency(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1548
static void Emergency(Exception Exception, string Object, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1616
static void Emergency(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1593
static void Emergency(string Message, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1485
static void Register(IEventSink EventSink)
Registers an event sink with the event log. Call Unregister(IEventSink) to unregister it,...
Definition: Log.cs:29
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1647
static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:715
static void Notice(string Message, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Definition: Log.cs:512
static void Debug(string Message, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs a debug event.
Definition: Log.cs:266
static void Debug(string Message, params KeyValuePair< string, object >[] Tags)
Logs a debug event.
Definition: Log.cs:313
static void Error(Exception Exception, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:934
static void Alert(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1260
static void Exception(Exception Exception, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1725
static void Exception(Exception Exception, string Object, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1715
static void Informational(string Message, string Object, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Definition: Log.cs:419
static void Error(string Message, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:777
static void Error(Exception Exception, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:983
static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Definition: Log.cs:566
static T[] Join< T >(this T[] Array, params T[] NewElements)
Joins two arrays
Definition: Log.cs:1787
static void Debug(string Message, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs a debug event.
Definition: Log.cs:292
static void Critical(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1050
static void Error(string Message, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:756
static void Critical(string Message, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1091
static void Warning(string Message, string Object, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Definition: Log.cs:651
static void Alert(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1354
static void Critical(string Message, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1065
static void Alert(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1369
static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Definition: Log.cs:614
static void Debug(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs a debug event.
Definition: Log.cs:235
static void Critical(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1017
static void Exception(Exception Exception, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1704
static void Alert(Exception Exception, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1416
static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Definition: Log.cs:367
static void Critical(Exception Exception, string Object, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1196
static void Alert(string Message, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1322
static EventType GetEventType(Exception Exception)
Gets the event type corresponding to a given exception object.
Definition: Log.cs:1736
static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:730
static void Critical(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1034
static void Error(Exception Exception, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:908
static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:682
static void Error(string Message, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:744
static void Emergency(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1437
static void Critical(Exception Exception, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1185
static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Definition: Log.cs:334
static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:699
static void Debug(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs a debug event.
Definition: Log.cs:251
static void Error(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:851
static void Critical(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1128
static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Definition: Log.cs:483
static Exception UnnestException(Exception Exception)
Unnests an exception, to extract the relevant inner exception.
Definition: Log.cs:818
static bool Unregister(IEventSink EventSink)
Unregisters an event sink from the event log.
Definition: Log.cs:46
static void Emergency(string Message, string Object, string Actor, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1511
static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Definition: Log.cs:450
static void Critical(string Message, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1079
static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Definition: Log.cs:599
static void Critical(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1144
static void Debug(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a debug event.
Definition: Log.cs:218
static void Critical(Exception Exception, params KeyValuePair< string, object >[] Tags)
Logs a critical event.
Definition: Log.cs:1206
static void Warning(string Message, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Definition: Log.cs:628
static void Informational(string Message, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Definition: Log.cs:396
static void Alert(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1227
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1678
static void Alert(string Message, string Object, string Actor, string EventId, params KeyValuePair< string, object >[] Tags)
Logs an alert event.
Definition: Log.cs:1289
static void Emergency(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an emergency event.
Definition: Log.cs:1454
static async void Event(Event Event)
Logs an event. It will be distributed to registered event sinks.
Definition: Log.cs:128
static void Notice(string Message, string Object, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Definition: Log.cs:535
static void Error(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:793
virtual string ObjectID
Object ID, used when logging events.
Definition: LogObject.cs:25
Interface for all event sinks.
Definition: IEventSink.cs:9
EventLevel
Event level.
Definition: EventLevel.cs:7
EventType
Type of event.
Definition: EventType.cs:7