summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-10-06 22:23:54 -0700
committerelijah <elijah@riseup.net>2016-10-06 22:23:54 -0700
commitae5d132c2747af10651d8747bcad30cc0b4b12b7 (patch)
treea45f936960366a23f47e8ea6e5e3da001aaaacba
parent2fdfc4ed731c6c82b7d5ebf995eb114b416a53d8 (diff)
[feat] ui - log all events to console, for now.
-rw-r--r--ui/app/app.js2
-rw-r--r--ui/app/lib/event_logger.js59
2 files changed, 61 insertions, 0 deletions
diff --git a/ui/app/app.js b/ui/app/app.js
index 3b3ac5de..75c7cb8a 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -1,6 +1,7 @@
import bitmask from 'lib/bitmask'
import Account from 'models/account'
import Provider from 'models/provider'
+import EventLogger from 'lib/event_logger'
class Application {
constructor() {
@@ -10,6 +11,7 @@ class Application {
// main entry point for the application
//
initialize() {
+ this.ev = new EventLogger()
if (this.debugging()) {
this.show(this.debug_panel)
} else {
diff --git a/ui/app/lib/event_logger.js b/ui/app/lib/event_logger.js
new file mode 100644
index 00000000..368b5cec
--- /dev/null
+++ b/ui/app/lib/event_logger.js
@@ -0,0 +1,59 @@
+import bitmask from 'lib/bitmask'
+
+const GENERAL_NOTICES = [
+ "KEYMANAGER_KEY_FOUND", // (address)
+ "KEYMANAGER_KEY_NOT_FOUND", // (address)
+ "KEYMANAGER_LOOKING_FOR_KEY", // (address)
+ "KEYMANAGER_DONE_UPLOADING_KEYS", // (address)
+
+ "SMTP_START_ENCRYPT_AND_SIGN", // (from_addr)
+ "SMTP_END_ENCRYPT_AND_SIGN", // (from_addr)
+ "SMTP_START_SIGN", // (from_addr)
+ "SMTP_END_SIGN", // (from_addr)
+ "SMTP_SEND_MESSAGE_START", // (from_addr)
+ "SMTP_SEND_MESSAGE_SUCCESS" // (from_addr)
+]
+
+const ACCOUNT_NOTICES = [
+ "IMAP_CLIENT_LOGIN", // (username)
+
+ "MAIL_FETCHED_INCOMING", // (userid)
+ "MAIL_MSG_DECRYPTED", // (userid)
+ "MAIL_MSG_DELETED_INCOMING", // (userid)
+ "MAIL_MSG_PROCESSING", // (userid)
+ "MAIL_MSG_SAVED_LOCALLY", // (userid)
+
+ "SMTP_RECIPIENT_ACCEPTED_ENCRYPTED", // (userid, dest)
+ "SMTP_RECIPIENT_ACCEPTED_UNENCRYPTED", // (userid, dest)
+ "SMTP_RECIPIENT_REJECTED", // (userid, dest)
+ "SMTP_SEND_MESSAGE_ERROR" // (userid, dest)
+]
+
+const STATUSES = [
+ "KEYMANAGER_FINISHED_KEY_GENERATION", // (address)
+ "KEYMANAGER_STARTED_KEY_GENERATION", // (address)
+ "SMTP_SERVICE_STARTED",
+ "MAIL_UNREAD_MESSAGES", // (userid, number)
+ "IMAP_SERVICE_STARTED"
+]
+
+const STATUS_ERRORS = [
+ "IMAP_SERVICE_FAILED_TO_START",
+ "IMAP_UNHANDLED_ERROR",
+ "SMTP_SERVICE_FAILED_TO_START",
+ "SMTP_CONNECTION_LOST", // (userid, dest)
+]
+
+export default class EventLogger {
+ constructor() {
+ this.logEvent = this.logEvent.bind(this)
+ let events = [].concat(GENERAL_NOTICES, ACCOUNT_NOTICES, STATUSES, STATUS_ERRORS)
+ for (let event of events) {
+ console.log('register event ' + event)
+ bitmask.events.register(event, this.logEvent)
+ }
+ }
+ logEvent(event, msg) {
+ console.log("EVENT: " + event, msg)
+ }
+} \ No newline at end of file