HttpServerBoxed 0.0.11 alpha
A simple http server for C# and .NET
Loading...
Searching...
No Matches
HSB.Debugger Class Reference

Public Member Functions

 Debugger (bool enabled, bool verbose, int port, string address, string logPath="", LOG_LEVEL logLevel=LOG_LEVEL.INFO)
 
void ERROR< T > (T o, bool printExtraInfo=true)
 
void WARNING< T > (T o, bool printExtraInfo=true)
 
void INFO< T > (T o, bool printExtraInfo=true)
 
void DEBUG< T > (T o, bool printExtraInfo=true)
 

Static Public Member Functions

static Debugger FromJson (JsonElement json)
 

Public Attributes

bool enabled
 
bool verbose
 
int port
 
string address
 
string logPath
 
LOG_LEVEL logLevel
 
bool UseDebugCertificate
 

Detailed Description

Definition at line 5 of file Debugger.cs.

Constructor & Destructor Documentation

◆ Debugger() [1/2]

HSB.Debugger.Debugger ( )

Definition at line 20 of file Debugger.cs.

21 {
22 enabled = false;
23 verbose = true;
24 port = 8081;
25 address = "127.0.0.1";
26 logPath = Path.Combine(AppContext.BaseDirectory, $"log_{GetDateFormatted()}.txt");
27 logLevel = LOG_LEVEL.INFO;
28
29 StartDebugServer();
30 }

◆ Debugger() [2/2]

HSB.Debugger.Debugger ( bool  enabled,
bool  verbose,
int  port,
string  address,
string  logPath = "",
LOG_LEVEL  logLevel = LOG_LEVEL::INFO 
)

Definition at line 33 of file Debugger.cs.

35 {
36 this.enabled = enabled;
37 this.verbose = verbose;
38 this.port = port;
39 this.address = address;
40 this.logPath = logPath == "" ? $"{AppContext.BaseDirectory}log_{GetDateFormatted()}.txt" : logPath;
41 this.logLevel = logLevel;
42
43 StartDebugServer();
44 }

Member Function Documentation

◆ DEBUG< T >()

void HSB.Debugger.DEBUG< T > ( o,
bool  printExtraInfo = true 
)

Definition at line 108 of file Debugger.cs.

109 {
110 if (verbose)
111 Terminal.DEBUG(o, printExtraInfo);
112 if (logLevel == LOG_LEVEL.ALL && logLevel > 0 && o != null)
113 {
114 var msg = o.ToString() ?? "";
115 AppendToFile(GetMessage("D", msg));
116 }
117 }

◆ ERROR< T >()

void HSB.Debugger.ERROR< T > ( o,
bool  printExtraInfo = true 
)

Definition at line 73 of file Debugger.cs.

74 {
75 if (verbose)
76 Terminal.ERROR(o, printExtraInfo);
77 if((int) logLevel <= (int)LOG_LEVEL.ERROR && logLevel > 0 && o != null)
78 {
79 var msg = o.ToString() ?? "";
80 AppendToFile(GetMessage("W", msg));
81 }
82 }

◆ FromJson()

static Debugger HSB.Debugger.FromJson ( JsonElement  json)
static

Definition at line 61 of file Debugger.cs.

62 {
63 return new Debugger(
64 json.GetProperty("enabled").GetBoolean(),
65 json.GetProperty("verbose").GetBoolean(),
66 json.GetProperty("port").GetInt16(),
67 json.GetProperty("address").GetString() ?? "127.0.0.1",
68 json.GetProperty("logPath").GetString() ?? "",
69 (LOG_LEVEL)json.GetProperty("logLevel").GetInt16()
70 );
71 }

◆ INFO< T >()

void HSB.Debugger.INFO< T > ( o,
bool  printExtraInfo = true 
)

Definition at line 96 of file Debugger.cs.

97 {
98 if (verbose)
99 Terminal.INFO(o, printExtraInfo);
100
101 if((int) logLevel <= (int)LOG_LEVEL.INFO && logLevel > 0 && o != null)
102 {
103 var msg = o.ToString() ?? "";
104 AppendToFile(GetMessage("I", msg));
105 }
106 }

◆ WARNING< T >()

void HSB.Debugger.WARNING< T > ( o,
bool  printExtraInfo = true 
)

Definition at line 84 of file Debugger.cs.

85 {
86 if (verbose)
87 Terminal.WARNING(o, printExtraInfo);
88
89 if((int) logLevel <= (int)LOG_LEVEL.WARNING && logLevel > 0 && o != null)
90 {
91 var msg = o.ToString() ?? "";
92 AppendToFile(GetMessage("W", msg));
93 }
94 }

Member Data Documentation

◆ address

string HSB.Debugger.address

Definition at line 11 of file Debugger.cs.

◆ enabled

bool HSB.Debugger.enabled

Definition at line 8 of file Debugger.cs.

◆ logLevel

LOG_LEVEL HSB.Debugger.logLevel

Definition at line 13 of file Debugger.cs.

◆ logPath

string HSB.Debugger.logPath

Definition at line 12 of file Debugger.cs.

◆ port

int HSB.Debugger.port

Definition at line 10 of file Debugger.cs.

◆ UseDebugCertificate

bool HSB.Debugger.UseDebugCertificate

Definition at line 15 of file Debugger.cs.

◆ verbose

bool HSB.Debugger.verbose

Definition at line 9 of file Debugger.cs.


The documentation for this class was generated from the following file: