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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 814 - (hide annotations) (download)
Tue Apr 15 15:58:50 2014 UTC (7 years ago) by william
File size: 2036 byte(s)

1 william 814 #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     public class LoggingFlagsConverter
13     {
14     private ushort flags;
15     public LoggingFlagsConverter(ushort flags)
16     {
17     this.flags = flags;
18     }
19    
20     public LogLevel ConvertFlags()
21     {
22     loggerflags f = this.flags;
23    
24     LogLevel lvl = LogLevel.kLogLevel_None;
25    
26     if (f.HasFlag(loggerflagsbase<ushort>.INFO))
27     {
28     lvl |= LogLevel.kLogLevel_Info;
29     }
30     if (f.HasFlag(loggerflagsbase<ushort>.WARN))
31     {
32     lvl |= LogLevel.kLogLevel_Warn;
33     }
34     if (f.HasFlag(loggerflagsbase<ushort>.DEBUG))
35     {
36     lvl |= LogLevel.kLogLevel_Debug;
37     }
38     if (f.HasFlag(loggerflagsbase<ushort>.ERROR))
39     {
40     lvl |= LogLevel.kLogLevel_Error;
41     }
42     if (f.HasFlag(loggerflagsbase<ushort>.PROFILER))
43     {
44     lvl |= LogLevel.kLogLevel_Profiler;
45     }
46     if (f.HasFlag(loggerflagsbase<ushort>.VERBOSE_DEBUG))
47     {
48     lvl |= LogLevel.kLogLevel_VerboseDebug;
49     }
50     if (f.HasFlag(loggerflagsbase<ushort>.VERBOSE_ERROR))
51     {
52     lvl |= LogLevel.kLogLevel_VerboseError;
53     }
54    
55    
56     if (f.HasFlag(loggerflagsbase<ushort>.DEFAULT))
57     {
58     lvl = LogLevel.kLogLevel_Default;
59     }
60     if (f.HasFlag(loggerflagsbase<ushort>.ALL))
61     {
62     lvl = LogLevel.kLogLevel_All;
63     }
64     return lvl;
65     }
66     }
67     #endif
68     }

  ViewVC Help
Powered by ViewVC 1.1.22