 
     get_log: (opts={}) ->
         opts = defaults opts,
-            start_time : required
-            end_time   : required
-            event      : undefined
-            cb         : required
-         # TODO
+            start : undefined     # if not given start at beginning of time
+            end   : undefined     # if not given include everything until now
+            event : undefined
+            cb    : required
+        query = @db.table('central_log')
+        if opts.start? or opts.end?   # impose an interval of time constraint
+            if not opts.start?
+                opts.start = new Date(0)
+            if not opts.end?
+                opts.end = new Date()
+            query = query.between(opts.start, opts.end, {index:'time'})
+        if opts.event?  # restrict to only the given event
+            query = query.filter(@r.row("event").eq(opts.event))
+        query.run(opts.cb)
 
     #####################################
     # User Account Management
     #####################################
+    create_account: (opts={}) ->
+        opts = defaults opts,
+            first_name        : required
+            last_name         : required
+
+            email_address     : undefined
+            password_hash     : undefined
+
+            passport_strategy : undefined
+            passport_id       : undefined
+            passport_profile  : undefined
+            cb                : required
+
+        dbg = @dbg("create_account(#{opts.first_name}, #{opts.last_name} #{opts.email_address}, #{opts.passport_strategy}, #{opts.passport_id})")
+        dbg()
+
+        if opts.email_address? # canonicalize the email address, if given
+            opts.email_address = misc.lower_email_address(opts.email_address)
+
+        async.series([
+            (cb) =>
+                # Verify in parallel that there's no account already with the
+                # requested email or passport.  This should never fail, except
+                # in case of some sort of rare bug or race condition where a
+                # person tries to sign up several times at once.
+                async.parallel([
+                    (cb) =>
+                        if not opts.email_address?
+                            cb(); return
+                        dbg("verify that no account with the given email (='#{opts.email_address}') already exists")
+                        @account_exists
+                            email_address : opts.email_address
+                            cb : (err, account_id) =>
+                                if err
+                                    cb(err)
+                                else if account_id
+                                    cb("account with email address '#{opts.email_address}' already exists")
+                                else
+                                    cb()
+                    (cb) =>
+                        if not opts.passport_strategy?
+                            cb(); return
+                        dbg("verify that no account with passport strategy (='#{opts.passport_strategy}') already exists")
+                        @passport_exists
+                            strategy : opts.passport_strategy
+                            id       : opts.passport_id
+                            cb       : (err, account_id) ->
+                                if err
+                                    cb(err)
+                                else if account_id
+                                    cb("account with email passport strategy '#{opts.passport_strategy}' and id '#{opts.passport_id}' already exists")
+                                else
+                                    cb()
+                ], cb)
+
+            (cb) =>
+                dbg("create the actual account")
+                @update
+                    table :'accounts'
+                    set   :
+                        first_name    : opts.first_name
+                        last_name     : opts.last_name
+                        email_address : opts.email_address
+                        password_hash : opts.password_hash
+                        created       : now()
+                    where : {account_id:account_id}
+                    cb    : cb
+
+            # add 1 to the "number of accounts" counter
+            (cb) =>
+                @update_table_counter
+                    table : 'accounts'
+                    delta : 1
+                    cb    : cb
+        ], (err) =>
+            if err
+                dbg("error creating account -- #{err}")
+                opts.cb(err)
+            else
+                dbg("successfully created account")
+                opts.cb(false, account_id)
+        )
+
+
     account_ids_to_usernames: (opts) =>
         opts = defaults opts,
             account_ids : required

            strategy : required
            id       : required
            cb       : required   # cb(err, account_id or undefined)

    account_exists: (opts) =>
        opts = defaults opts,
            email_address : required
            cb            : required   # cb(err, account_id or false) -- true if account exists; err = problem with db connection...

    account_creation_actions: (opts) =>
        opts = defaults opts,

winston = require('winston')
winston.remove(winston.transports.Console)
winston.add(winston.transports.Console, {level: 'debug', timestamp:true, colorize:true})
