alarm_msg.go 569 B

12345678910111213141516171819202122232425
  1. package alarm_msg
  2. import (
  3. "encoding/json"
  4. "eta_gn/eta_bridge/global"
  5. "eta_gn/eta_bridge/utils"
  6. )
  7. var (
  8. AlarmMsgUrl = "http://127.0.0.1:8606/api/alarm/send"
  9. )
  10. func SendAlarmMsg(msgBody string, level int) {
  11. params := make(map[string]interface{})
  12. params["ProjectName"] = utils.APPNAME
  13. params["RunMode"] = global.CONFIG.Serve.RunMode
  14. params["MsgBody"] = msgBody
  15. params["Level"] = level
  16. param, err := json.Marshal(params)
  17. if err != nil {
  18. global.LOG.Critical("SendAlarmMsg json.Marshal Err:" + err.Error())
  19. return
  20. }
  21. global.FILE_LOG.Info(string(param))
  22. }