MessageType.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef __MESSAGE_TYPE_H
  2. #define __MESSAGE_TYPE_H
  3. #pragma once
  4. #include <string>
  5. enum MessageType : int
  6. {
  7. Info = 0, //info message, no response
  8. BeginSession = 1, //start entity session
  9. EndSession = 2, //end entity session
  10. Request = 3, //call request
  11. RequestAck = 4, //request acknowledge
  12. SessionAck = 5, //start session acknowledge
  13. Register = 6, //register entity event
  14. Unregister = 7, //unregister entity event
  15. Event = 8, //event message
  16. LogEventMsgType = 9, //log event
  17. LogWarnMsgType = 10, //log warn
  18. SetVarReq = 11, //set sysvar request
  19. SetVarAck = 12, //set sysvar response
  20. GetVarReq = 13, //get sysvar request
  21. GetVarAck = 14, //get sysvar response
  22. Broadcast = 15, //broadcast msg to other entity
  23. GetSession = 16, //chromium session info
  24. // 0x00 00 00 00 - 0x00 00 FF FF for web to binary, communicate with other entity
  25. // 0x00 01 00 00 - 0x00 01 FF FF for web to chromium
  26. WEB_CHROMIUM_MSG_BEGIN = 0x00010000,
  27. RegisterNotify = 0x00010001, //web register Notify Msg
  28. UnRegisterNotify, //web unregister Notify
  29. WEB_CHROMIUM_MSG_END = 0x0001FFFF,
  30. METHOD_SYSTEM_START = 0x2F0000,
  31. METHOD_SYSTEM_LOG_DEBUG,
  32. METHOD_SYSTEM_LOG_INFO,
  33. METHOD_SYSTEM_LOG_WARN,
  34. METHOD_SYSTEM_LOG_ERROR,
  35. METHOD_SYSTEM_DETAIL_LOG_DEBUG,
  36. METHOD_SYSTEM_DETAIL_LOG_INFO,
  37. METHOD_SYSTEM_DETAIL_LOG_WARN,
  38. METHOD_SYSTEM_DETAIL_LOG_ERROR,
  39. METHOD_SYSTEM_END = 0x2FFFFF,
  40. METHOD_BEIDOU_LOG = 0x3F0001,
  41. };
  42. #define PARAMLIST_HEAD "{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}"
  43. #define PKT_TYPE_CONTROL_LINKCONTEXT (1 << 31)
  44. typedef struct {
  45. char businessId[32]; //32
  46. char traceId[32]; //32
  47. char spanId[16]; //16
  48. char parentSpanId[16]; //16
  49. char timestamp[16]; //16
  50. int reservedControl;
  51. }link_context;
  52. //(1)鍙戠幇linux涓媔nline鏈夐棶棰橈紝鎵╁睍涓嶅紑锛?锛夊瓨鍦ㄥ畯瀹氫箟鎷兼帴鏃讹紝鍑虹幇闂��
  53. std::string GetMessageTypeString(int messageType);
  54. #endif
  55. /* log detail
  56. MessageType include:METHOD_SYSTEM_DETAIL_LOG_DEBUG(3080197), METHOD_SYSTEM_DETAIL_LOG_INFO, METHOD_SYSTEM_DETAIL_LOG_WARN, METHOD_SYSTEM_DETAIL_LOG_ERROR,
  57. {
  58. "messageType": 3080198,
  59. "EntityName": "postmanpostman",
  60. "ResultMsg": "for LogTest from postman",
  61. "LogType": "User",
  62. "CostTime": 444,
  63. "ResultCode": "RTA444444",
  64. "LogCode": "ASDASSD",
  65. "API": "postman::test",
  66. "SourceType": "test.cpp",
  67. "BussID":"asdfafwerwqerqwerwerqwerwqerwerwqerwqerqwer",
  68. "TipMsg":"fjoawjerfownfojinwiqfneuiwnefionwfnewqionr",
  69. "BeginTime":123456,
  70. "EndTime":234567
  71. }
  72. messageType must have
  73. EntityName must have, it mean your upload entityName
  74. ResultMsg must have, it means your log
  75. LogType Not necessarily needed, if it equals to User, means upload it as LOG_TYPE_USER, otherwise, upload as LOG_TYPE_SYSTEM
  76. CostTime Not necessarily needed, it means how much time used
  77. ResultCode Not necessarily needed, Commonly, filling it with error code.
  78. LogCode Not necessarily needed, Commonly, filling it such as QLR0402402Z00001
  79. API Not necessarily needed, current API which you are using
  80. SourceType Not necessarily needed, current file and line when the code is running
  81. BussID Not necessarily needed,like the beidou
  82. TipMsg Not necessarily needed,what the msg you desired to show when errors cause
  83. BegtinTime Not necessarily needed, begin Time
  84. EndTime Not necessarily needed, end Time
  85. */