 
 (defn log-request-information
     [request]
-    (println "time:        " (.toString (new java.util.Date)))
-    (println "addr:        " (request :remote-addr))
-    (println "params:      " (request :params))
-    (println "user-agent:  " ((request :headers) "user-agent"))
-    (println ""))
+    (println-and-flush "time:        " (.toString (new java.util.Date)))
+    (println-and-flush "addr:        " (request :remote-addr))
+    (println-and-flush "params:      " (request :params))
+    (println-and-flush "user-agent:  " ((request :headers) "user-agent"))
+    (println-and-flush ""))
 
 (defn get-products-without-descriptions
     [products package-descriptions]

          new-description     (get params "new-description")
          new-user-name       (get params "user-name")
          old-user-name       (get (get cookies "user-name") :value)]
          (println "Incoming cookies: " cookies)
          (let [response (process package new-description format new-user-name old-user-name)]
              (println "Outgoing cookies: " (get response :cookies))
              response
          )))


    [request]
    (let [descriptions (read-all-descriptions)
          user-name    (get (get (request :cookies) "user-name") :value)]
        ;(println-and-flush descriptions)
        (-> (http-response/response (html-renderer-descriptions descriptions user-name))
            (http-response/content-type "text/html"))))

(defn return-file
    [file-name content-type]
    (let [file (new java.io.File "www" file-name)]
        (println-and-flush "Returning file " (.getAbsolutePath file))
        (println-and-flush "")
        (-> (http-response/response file)
            (http-response/content-type content-type))))

(defn handler
    "Handler that is called by Ring for all requests received from user(s)."
    [request]
    (println-and-flush "request URI: " (request :uri))
    (let [uri (request :uri)]
        (condp = uri
            "/favicon.ico"       (return-file "favicon.ico" "image/x-icon")
