Changeset 865


Ignore:
Timestamp:
01/20/2011 12:48:07 PM (10 years ago)
Author:
dave
Message:

added server activity log

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scenarios/GerminationX/oak/src/oak/core.clj

    r846 r865  
    22  (:use 
    33   compojure.core 
     4   clojure.contrib.duck-streams 
    45   ring.adapter.jetty 
    56   ring.middleware.file 
     
    1314   oak.tile) 
    1415  (:import 
    15    java.util.concurrent.Executors) 
     16   java.util.concurrent.Executors 
     17   java.util.Date) 
    1618  (:require [compojure.route :as route] 
    1719            [org.danlarkin.json :as json]))  
     
    2426 
    2527(def state-filename "state.txt") 
     28(def log-filename "public/log.txt") 
    2629 
    2730(def myworld 
     
    3942;(world-crank (deref myworld)) 
    4043 
     44(append-spit log-filename (str (str (Date.)) " server started\n")) 
     45 
    4146(defn parse [s] 
    4247  (try (Integer/parseInt (.trim s)) 
     
    5358  (GET "/make-plant/:tilex/:tiley/:posx/:posy/:type/:owner/:size" 
    5459       [tilex tiley posx posy type owner size] 
     60       (append-spit 
     61        log-filename 
     62        (str 
     63         (str (Date.)) " " owner " has created a " type " at tile " 
     64         tilex "," tiley " position " posx "," posy "\n")) 
    5565       (dosync 
    5666        (ref-set my-game-world 
Note: See TracChangeset for help on using the changeset viewer.