OCPPLog.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. 
  2. using SuperSocket.SocketBase.Logging;
  3. using System;
  4. namespace OCPPServer.SubProtocol
  5. {
  6. public class OCPPLog : ILog
  7. {
  8. private NLog.ILogger m_Log;
  9. public OCPPLog(string name)
  10. {
  11. m_Log = NLog.LogManager.GetCurrentClassLogger();
  12. }
  13. /// <summary>
  14. /// Gets a value indicating whether this instance is debug enabled.
  15. /// </summary>
  16. /// <value>
  17. /// <c>true</c> if this instance is debug enabled; otherwise, <c>false</c>.
  18. /// </value>
  19. public bool IsDebugEnabled
  20. {
  21. get { return m_Log.IsDebugEnabled; }
  22. }
  23. /// <summary>
  24. /// Gets a value indicating whether this instance is error enabled.
  25. /// </summary>
  26. /// <value>
  27. /// <c>true</c> if this instance is error enabled; otherwise, <c>false</c>.
  28. /// </value>
  29. public bool IsErrorEnabled
  30. {
  31. get { return m_Log.IsErrorEnabled; }
  32. }
  33. /// <summary>
  34. /// Gets a value indicating whether this instance is fatal enabled.
  35. /// </summary>
  36. /// <value>
  37. /// <c>true</c> if this instance is fatal enabled; otherwise, <c>false</c>.
  38. /// </value>
  39. public bool IsFatalEnabled
  40. {
  41. get { return m_Log.IsFatalEnabled; }
  42. }
  43. /// <summary>
  44. /// Gets a value indicating whether this instance is info enabled.
  45. /// </summary>
  46. /// <value>
  47. /// <c>true</c> if this instance is info enabled; otherwise, <c>false</c>.
  48. /// </value>
  49. public bool IsInfoEnabled
  50. {
  51. get { return m_Log.IsInfoEnabled; }
  52. }
  53. /// <summary>
  54. /// Gets a value indicating whether this instance is warn enabled.
  55. /// </summary>
  56. /// <value>
  57. /// <c>true</c> if this instance is warn enabled; otherwise, <c>false</c>.
  58. /// </value>
  59. public bool IsWarnEnabled
  60. {
  61. get { return m_Log.IsWarnEnabled; }
  62. }
  63. /// <summary>
  64. /// Logs the debug message.
  65. /// </summary>
  66. /// <param name="message">The message.</param>
  67. public void Debug(object message)
  68. {
  69. m_Log.Debug(message);
  70. }
  71. /// <summary>
  72. /// Logs the debug message.
  73. /// </summary>
  74. /// <param name="message">The message.</param>
  75. /// <param name="exception">The exception.</param>
  76. public void Debug(object message, Exception exception)
  77. {
  78. //m_Log.Debug((System.IFormatProvider)message, exception);
  79. m_Log.Debug(exception, message.ToString());
  80. }
  81. /// <summary>
  82. /// Logs the debug message.
  83. /// </summary>
  84. /// <param name="format">The format.</param>
  85. /// <param name="arg0">The arg0.</param>
  86. public void DebugFormat(string format, object arg0)
  87. {
  88. }
  89. /// <summary>
  90. /// Logs the debug message.
  91. /// </summary>
  92. /// <param name="format">The format.</param>
  93. /// <param name="args">The args.</param>
  94. public void DebugFormat(string format, params object[] args)
  95. {
  96. }
  97. /// <summary>
  98. /// Logs the debug message.
  99. /// </summary>
  100. /// <param name="provider">The provider.</param>
  101. /// <param name="format">The format.</param>
  102. /// <param name="args">The args.</param>
  103. public void DebugFormat(IFormatProvider provider, string format, params object[] args)
  104. {
  105. }
  106. /// <summary>
  107. /// Logs the debug message.
  108. /// </summary>
  109. /// <param name="format">The format.</param>
  110. /// <param name="arg0">The arg0.</param>
  111. /// <param name="arg1">The arg1.</param>
  112. public void DebugFormat(string format, object arg0, object arg1)
  113. {
  114. }
  115. /// <summary>
  116. /// Logs the debug message.
  117. /// </summary>
  118. /// <param name="format">The format.</param>
  119. /// <param name="arg0">The arg0.</param>
  120. /// <param name="arg1">The arg1.</param>
  121. /// <param name="arg2">The arg2.</param>
  122. public void DebugFormat(string format, object arg0, object arg1, object arg2)
  123. {
  124. }
  125. /// <summary>
  126. /// Logs the error message.
  127. /// </summary>
  128. /// <param name="message">The message.</param>
  129. public void Error(object message)
  130. {
  131. m_Log.Error(message);
  132. }
  133. /// <summary>
  134. /// Logs the error message.
  135. /// </summary>
  136. /// <param name="message">The message.</param>
  137. /// <param name="exception">The exception.</param>
  138. public void Error(object message, Exception exception)
  139. {
  140. //m_Log.Error((System.IFormatProvider)message, exception);
  141. m_Log.Error(exception.ToString());
  142. }
  143. /// <summary>
  144. /// Logs the error message.
  145. /// </summary>
  146. /// <param name="format">The format.</param>
  147. /// <param name="arg0">The arg0.</param>
  148. public void ErrorFormat(string format, object arg0)
  149. {
  150. }
  151. /// <summary>
  152. /// Logs the error message.
  153. /// </summary>
  154. /// <param name="format">The format.</param>
  155. /// <param name="args">The args.</param>
  156. public void ErrorFormat(string format, params object[] args)
  157. {
  158. }
  159. /// <summary>
  160. /// Logs the error message.
  161. /// </summary>
  162. /// <param name="provider">The provider.</param>
  163. /// <param name="format">The format.</param>
  164. /// <param name="args">The args.</param>
  165. public void ErrorFormat(IFormatProvider provider, string format, params object[] args)
  166. {
  167. }
  168. /// <summary>
  169. /// Logs the error message.
  170. /// </summary>
  171. /// <param name="format">The format.</param>
  172. /// <param name="arg0">The arg0.</param>
  173. /// <param name="arg1">The arg1.</param>
  174. public void ErrorFormat(string format, object arg0, object arg1)
  175. {
  176. }
  177. /// <summary>
  178. /// Logs the error message.
  179. /// </summary>
  180. /// <param name="format">The format.</param>
  181. /// <param name="arg0">The arg0.</param>
  182. /// <param name="arg1">The arg1.</param>
  183. /// <param name="arg2">The arg2.</param>
  184. public void ErrorFormat(string format, object arg0, object arg1, object arg2)
  185. {
  186. }
  187. /// <summary>
  188. /// Logs the fatal error message.
  189. /// </summary>
  190. /// <param name="message">The message.</param>
  191. public void Fatal(object message)
  192. {
  193. m_Log.Fatal(message);
  194. }
  195. /// <summary>
  196. /// Logs the fatal error message.
  197. /// </summary>
  198. /// <param name="message">The message.</param>
  199. /// <param name="exception">The exception.</param>
  200. public void Fatal(object message, Exception exception)
  201. {
  202. m_Log.Fatal((System.IFormatProvider)message, exception);
  203. }
  204. /// <summary>
  205. /// Logs the fatal error message.
  206. /// </summary>
  207. /// <param name="format">The format.</param>
  208. /// <param name="arg0">The arg0.</param>
  209. public void FatalFormat(string format, object arg0)
  210. {
  211. }
  212. /// <summary>
  213. /// Logs the fatal error message.
  214. /// </summary>
  215. /// <param name="format">The format.</param>
  216. /// <param name="args">The args.</param>
  217. public void FatalFormat(string format, params object[] args)
  218. {
  219. }
  220. /// <summary>
  221. /// Logs the fatal error message.
  222. /// </summary>
  223. /// <param name="provider">The provider.</param>
  224. /// <param name="format">The format.</param>
  225. /// <param name="args">The args.</param>
  226. public void FatalFormat(IFormatProvider provider, string format, params object[] args)
  227. {
  228. }
  229. /// <summary>
  230. /// Logs the fatal error message.
  231. /// </summary>
  232. /// <param name="format">The format.</param>
  233. /// <param name="arg0">The arg0.</param>
  234. /// <param name="arg1">The arg1.</param>
  235. public void FatalFormat(string format, object arg0, object arg1)
  236. {
  237. }
  238. /// <summary>
  239. /// Logs the fatal error message.
  240. /// </summary>
  241. /// <param name="format">The format.</param>
  242. /// <param name="arg0">The arg0.</param>
  243. /// <param name="arg1">The arg1.</param>
  244. /// <param name="arg2">The arg2.</param>
  245. public void FatalFormat(string format, object arg0, object arg1, object arg2)
  246. {
  247. }
  248. /// <summary>
  249. /// Logs the info message.
  250. /// </summary>
  251. /// <param name="message">The message.</param>
  252. public void Info(object message)
  253. {
  254. m_Log.Info(message);
  255. }
  256. /// <summary>
  257. /// Logs the info message.
  258. /// </summary>
  259. /// <param name="message">The message.</param>
  260. /// <param name="exception">The exception.</param>
  261. public void Info(object message, Exception exception)
  262. {
  263. //m_Log.Info((System.IFormatProvider)message, exception);
  264. m_Log.Info(exception, message.ToString());
  265. }
  266. /// <summary>
  267. /// Logs the info message.
  268. /// </summary>
  269. /// <param name="format">The format.</param>
  270. /// <param name="arg0">The arg0.</param>
  271. public void InfoFormat(string format, object arg0)
  272. {
  273. }
  274. /// <summary>
  275. /// Logs the info message.
  276. /// </summary>
  277. /// <param name="format">The format.</param>
  278. /// <param name="args">The args.</param>
  279. public void InfoFormat(string format, params object[] args)
  280. {
  281. }
  282. /// <summary>
  283. /// Logs the info message.
  284. /// </summary>
  285. /// <param name="provider">The provider.</param>
  286. /// <param name="format">The format.</param>
  287. /// <param name="args">The args.</param>
  288. public void InfoFormat(IFormatProvider provider, string format, params object[] args)
  289. {
  290. }
  291. /// <summary>
  292. /// Logs the info message.
  293. /// </summary>
  294. /// <param name="format">The format.</param>
  295. /// <param name="arg0">The arg0.</param>
  296. /// <param name="arg1">The arg1.</param>
  297. public void InfoFormat(string format, object arg0, object arg1)
  298. {
  299. }
  300. /// <summary>
  301. /// Logs the info message.
  302. /// </summary>
  303. /// <param name="format">The format.</param>
  304. /// <param name="arg0">The arg0.</param>
  305. /// <param name="arg1">The arg1.</param>
  306. /// <param name="arg2">The arg2.</param>
  307. public void InfoFormat(string format, object arg0, object arg1, object arg2)
  308. {
  309. }
  310. /// <summary>
  311. /// Logs the warning message.
  312. /// </summary>
  313. /// <param name="message">The message.</param>
  314. public void Warn(object message)
  315. {
  316. m_Log.Warn(message);
  317. }
  318. /// <summary>
  319. /// Logs the warning message.
  320. /// </summary>
  321. /// <param name="message">The message.</param>
  322. /// <param name="exception">The exception.</param>
  323. public void Warn(object message, Exception exception)
  324. {
  325. //m_Log.Warn((System.IFormatProvider)message, exception);
  326. m_Log.Warn(exception, message.ToString());
  327. }
  328. /// <summary>
  329. /// Logs the warning message.
  330. /// </summary>
  331. /// <param name="format">The format.</param>
  332. /// <param name="arg0">The arg0.</param>
  333. public void WarnFormat(string format, object arg0)
  334. {
  335. }
  336. /// <summary>
  337. /// Logs the warning message.
  338. /// </summary>
  339. /// <param name="format">The format.</param>
  340. /// <param name="args">The args.</param>
  341. public void WarnFormat(string format, params object[] args)
  342. {
  343. }
  344. /// <summary>
  345. /// Logs the warning message.
  346. /// </summary>
  347. /// <param name="provider">The provider.</param>
  348. /// <param name="format">The format.</param>
  349. /// <param name="args">The args.</param>
  350. public void WarnFormat(IFormatProvider provider, string format, params object[] args)
  351. {
  352. }
  353. /// <summary>
  354. /// Logs the warning message.
  355. /// </summary>
  356. /// <param name="format">The format.</param>
  357. /// <param name="arg0">The arg0.</param>
  358. /// <param name="arg1">The arg1.</param>
  359. public void WarnFormat(string format, object arg0, object arg1)
  360. {
  361. }
  362. /// <summary>
  363. /// Logs the warning message.
  364. /// </summary>
  365. /// <param name="format">The format.</param>
  366. /// <param name="arg0">The arg0.</param>
  367. /// <param name="arg1">The arg1.</param>
  368. /// <param name="arg2">The arg2.</param>
  369. public void WarnFormat(string format, object arg0, object arg1, object arg2)
  370. {
  371. }
  372. }
  373. }