-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pushing changes to 2018.3 branch (v 0.4.6)
- Loading branch information
1 parent
bad6917
commit 12d456e
Showing
7 changed files
with
40 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
package com.madrapps.eventbus | ||
|
||
import com.intellij.notification.NotificationDisplayType | ||
import com.intellij.notification.NotificationDisplayType.NONE | ||
import com.intellij.notification.NotificationGroup | ||
import com.intellij.notification.NotificationType | ||
import com.intellij.notification.NotificationType.ERROR | ||
import com.intellij.notification.NotificationType.INFORMATION | ||
import com.intellij.notification.Notifications | ||
import com.intellij.openapi.application.ApplicationManager | ||
import org.apache.commons.lang.exception.ExceptionUtils | ||
import java.time.LocalDateTime | ||
|
||
val notify = NotificationGroup("EventBus", NotificationDisplayType.NONE, false) | ||
val notify = NotificationGroup("GreenRobot EventBus", NONE, false) | ||
|
||
fun blog(msg: String) { | ||
val timedMsg = "${LocalDateTime.now()} : $msg" | ||
println(timedMsg) | ||
ApplicationManager.getApplication().invokeLater { | ||
Notifications.Bus.notify(notify.createNotification(timedMsg, NotificationType.INFORMATION)) | ||
} | ||
} | ||
fun blog(msg: String) = log(msg, INFORMATION) | ||
|
||
fun errLog(msg: String) = log(msg, ERROR) | ||
|
||
fun errLog(msg: String) { | ||
private fun log(msg: String, type: NotificationType) { | ||
val timedMsg = "${LocalDateTime.now()} : $msg" | ||
println(timedMsg) | ||
ApplicationManager.getApplication().invokeLater { | ||
Notifications.Bus.notify(notify.createNotification(timedMsg, NotificationType.ERROR)) | ||
Notifications.Bus.notify(notify.createNotification(timedMsg, type)) | ||
} | ||
} | ||
|
||
fun errLog(e: Throwable) { | ||
val timedMsg = "${LocalDateTime.now()} : ${e.message}" | ||
println(timedMsg) | ||
ApplicationManager.getApplication().invokeLater { | ||
Notifications.Bus.notify(notify.createNotification(timedMsg, NotificationType.ERROR)) | ||
Notifications.Bus.notify(notify.createNotification(ExceptionUtils.getFullStackTrace(e), NotificationType.ERROR)) | ||
Notifications.Bus.notify(notify.createNotification(timedMsg, ERROR)) | ||
Notifications.Bus.notify(notify.createNotification(ExceptionUtils.getFullStackTrace(e), ERROR)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters