refactor
This commit is contained in:
parent
d4b682a573
commit
1285a70612
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
// Notification manipulations.
|
// Package notification includes notification related manipulations.
|
||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -30,15 +30,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Error = "ERROR" // notification.severity: ERROR
|
error = "ERROR" // notification.severity: ERROR
|
||||||
Warn = "WARN" // notification.severity: WARN
|
warn = "WARN" // notification.severity: WARN
|
||||||
Info = "INFO" // notification.severity: INFO
|
info = "INFO" // notification.severity: INFO
|
||||||
|
|
||||||
Setup = "Setup" // notification.type: setup
|
setup = "Setup" // notification.type: setup
|
||||||
Server = "Server" // notification.type: server
|
server = "Server" // notification.type: server
|
||||||
)
|
)
|
||||||
|
|
||||||
// Notification.
|
// Notification represents a notification.
|
||||||
type Notification struct {
|
type Notification struct {
|
||||||
event *event.Event
|
event *event.Event
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
|
@ -68,10 +68,10 @@ func event2Notification(e *event.Event) {
|
||||||
case event.EvtCodeGocodeNotFound:
|
case event.EvtCodeGocodeNotFound:
|
||||||
fallthrough
|
fallthrough
|
||||||
case event.EvtCodeIDEStubNotFound:
|
case event.EvtCodeIDEStubNotFound:
|
||||||
notification = &Notification{event: e, Type: Setup, Severity: Error,
|
notification = &Notification{event: e, Type: setup, Severity: error,
|
||||||
Message: i18n.Get(locale, "notification_"+strconv.Itoa(e.Code)).(string)}
|
Message: i18n.Get(locale, "notification_"+strconv.Itoa(e.Code)).(string)}
|
||||||
case event.EvtCodeServerInternalError:
|
case event.EvtCodeServerInternalError:
|
||||||
notification = &Notification{event: e, Type: Server, Severity: Error,
|
notification = &Notification{event: e, Type: server, Severity: error,
|
||||||
Message: i18n.Get(locale, "notification_"+strconv.Itoa(e.Code)).(string) + " [" + e.Data.(string) + "]"}
|
Message: i18n.Get(locale, "notification_"+strconv.Itoa(e.Code)).(string) + " [" + e.Data.(string) + "]"}
|
||||||
default:
|
default:
|
||||||
glog.Warningf("Can't handle event[code=%d]", e.Code)
|
glog.Warningf("Can't handle event[code=%d]", e.Code)
|
||||||
|
|
Loading…
Reference in New Issue