/[RomCheater]/trunk/RomCheater.Logging/LoggingFlagsConverter.cs
ViewVC logotype

Contents of /trunk/RomCheater.Logging/LoggingFlagsConverter.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 828 - (show annotations) (download)
Mon Sep 15 21:36:20 2014 UTC (6 years, 2 months ago) by william
File size: 2110 byte(s)
+ update logging usage

1 #define ENABLE_LOGLEVEL_CONVERSION_FROM_OLD_LOGGER // this will be disabled once we fully move over to using Enterprise.Logging
2 using Enterprise.Logging;
3 using System;
4 using System.Collections.Generic;
5 using System.Diagnostics;
6 using System.Linq;
7 using System.Text;
8
9 namespace RomCheater.Logging
10 {
11 #if ENABLE_LOGLEVEL_CONVERSION_FROM_OLD_LOGGER
12 //[Obsolete("logging is being replaced by Enterprise.Logging.gLog")]
13 public class LoggingFlagsConverter
14 {
15 private ushort flags;
16 public LoggingFlagsConverter(ushort flags)
17 {
18 this.flags = flags;
19 }
20
21 public LogLevel ConvertFlags()
22 {
23 loggerflags f = this.flags;
24
25 LogLevel lvl = LogLevel.kLogLevel_None;
26
27 if (f.HasFlag(loggerflagsbase<ushort>.INFO))
28 {
29 lvl |= LogLevel.kLogLevel_Info;
30 }
31 if (f.HasFlag(loggerflagsbase<ushort>.WARN))
32 {
33 lvl |= LogLevel.kLogLevel_Warn;
34 }
35 if (f.HasFlag(loggerflagsbase<ushort>.DEBUG))
36 {
37 lvl |= LogLevel.kLogLevel_Debug;
38 }
39 if (f.HasFlag(loggerflagsbase<ushort>.ERROR))
40 {
41 lvl |= LogLevel.kLogLevel_Error;
42 }
43 if (f.HasFlag(loggerflagsbase<ushort>.PROFILER))
44 {
45 lvl |= LogLevel.kLogLevel_Profiler;
46 }
47 if (f.HasFlag(loggerflagsbase<ushort>.VERBOSE_DEBUG))
48 {
49 lvl |= LogLevel.kLogLevel_VerboseDebug;
50 }
51 if (f.HasFlag(loggerflagsbase<ushort>.VERBOSE_ERROR))
52 {
53 lvl |= LogLevel.kLogLevel_VerboseError;
54 }
55
56
57 if (f.HasFlag(loggerflagsbase<ushort>.DEFAULT))
58 {
59 lvl = LogLevel.kLogLevel_Default;
60 }
61 if (f.HasFlag(loggerflagsbase<ushort>.ALL))
62 {
63 lvl = LogLevel.kLogLevel_All;
64 }
65 return lvl;
66 }
67 }
68 #endif
69 }

  ViewVC Help
Powered by ViewVC 1.1.22