Browse files

the log succeed to be displaying to the view

  • Loading branch information...
1 parent 294ccd7 commit 6dffc9a8828a7c586ee4471c21c542229a4dc22e @srenault committed Feb 1, 2012
View
8 app/assets/javascripts/main.js
@@ -1,8 +1,7 @@
-$(function(window) {
+$(function() {
var session = {};
session.onReceive = function(log) {
- var message = _.template('<%= message %>');
- $('#logs').append('<li>'+ message(log) +'</li>');
+ $('#logs').append('<li>'+ log.message +'</li>');
};
session.bindUI = function() {
@@ -35,4 +34,5 @@ $(function(window) {
session.bindUI();
window.session = session;
-})(window);
+ alert(window.session);
+});
View
5 app/controllers/Actors.scala
@@ -23,11 +23,14 @@ class StoryActor extends Actor {
pushee => self ! Init(pushee),
onComplete = self ! Quit()
)
- //logs = Some(channel)
Logger.info("New debugging session")
sender ! channel
}
+ case Init(pushee) => {
+ logs = Some(pushee)
+ }
+
case Quit() => {
Logger.info("Debugging session has been stopped ...")
logs=None
View
18 app/controllers/Application.scala
@@ -33,17 +33,14 @@ object Application extends Controller {
}
def eval() = ToJsObject { json =>
+ println(json)
StoryActor.ref ! NewLog(Log.fromJsObject(json))
Ok
}
private def ToJsObject(action: JsObject => Result) = Action { implicit request =>
Logger.info("entering")
- Form(
- (
- "data" -> nonEmptyText
- )
- ).bindFromRequest.fold(
+ Form(("data" -> nonEmptyText)).bindFromRequest.fold(
err => BadRequest("Empty json ?"), {
case jsonStr => Json.parse(jsonStr) match {
case jsObj: JsObject => action(jsObj)
@@ -54,14 +51,3 @@ object Application extends Controller {
)
}
}
-
-/* val computerForm = Form(
- mapping(
- "id" -> ignored(NotAssigned:Pk[Long]),
- "name" -> nonEmptyText,
- "introduced" -> optional(date("yyyy-MM-dd")),
- "discontinued" -> optional(date("yyyy-MM-dd")),
- "company" -> optional(longNumber)
- )(Computer.apply)(Computer.unapply)
- )
-*/
View
10 app/models/Log.scala
@@ -8,19 +8,19 @@ import play.api.libs.json.Json._
import java.util.Date
case class Log(logger: String,
- file: String,
+ className: String,
date: String,
+ file: String,
location: String,
- line: Long,
+ line: String,
message: String,
method: String,
level: String,
- thread: String,
- receivedAt: Long = new Date().getTime())
+ thread: String)
object Log {
def fromJsObject(json: JsObject) = fromJson[Log](json)
import play.api.libs.json.Generic._
- implicit val LogFormat: Format[Log] = productFormat10("logger", "file", "date", "location", "line", "message", "method", "level", "thread", "receivedAt")(Log.apply)(Log.unapply(_))
+ implicit val LogFormat: Format[Log] = productFormat10("logger", "class", "date", "file", "location", "line", "message", "method", "level", "thread")(Log.apply)(Log.unapply(_))
}
View
1 app/views/index.scala.html
@@ -35,6 +35,7 @@
</div>
<div id="logs" class="block">
<ul>
+ </ul>
</div>
<iframe id="stream" src="#" style="display: none;"></iframe>
</body>
View
6 conf/routes
@@ -3,9 +3,9 @@
# ~~~~
# Home page
-GET / controllers.Application.index()
+GET / controllers.Application.index()
GET /story/listen controllers.Application.listen()
-GET /story/eval controllers.Application.eval()
+POST /story/eval controllers.Application.eval()
# Map static resources from the /public folder to the /assets URL path
-GET /assets/*file controllers.Assets.at(path="/public", file)
+GET /assets/*file controllers.Assets.at(path="/public", file)
View
251 samples/application.conf
@@ -0,0 +1,251 @@
+# This is the main configuration file for the application.
+# ~~~~~
+application.name=server
+
+# Application mode
+# ~~~~~
+# Set to dev to enable instant reloading and other development help.
+# Otherwise set to prod.
+application.mode=dev
+%stage.application.mode=prod
+
+# Secret key
+# ~~~~~
+# The secret key is used to secure cryptographics functions
+# If you deploy your application to several instances be sure to use the same key !
+application.secret=6SU8fsEKA5LRr5jqwwZKBCEEseLNZQ8t7BYBtMShHLJstoi3rbBZmPTTIW0ykhq7
+
+# i18n
+# ~~~~~
+# Define locales used by your application.
+# You can then place localized messages in conf/messages.{locale} files
+application.langs=fr
+
+# Date format
+# ~~~~~
+date.format=yyyy-MM-dd
+# date.format.fr=dd/MM/yyyy
+
+# Server configuration
+# ~~~~~
+# If you need to change the HTTP port, uncomment this (default is set to 9000)
+# http.port=9000
+#
+# By default the server listen for HTTP on the wilcard address.
+# You can restrict this.
+# http.address=127.0.0.1
+#
+# Use this if you don't host your Play application at the root of the domain
+# you're serving it from. This parameter has no effect when deployed as a
+# war, because the path will be handled by the application server.
+# http.path=/
+
+# Session configuration
+# ~~~~~~~~~~~~~~~~~~~~~~
+# By default, session will be written to the transient PLAY_SESSION cookie.
+# The cookies are not secured by default, only set it to true
+# if you're serving your pages through https.
+# application.session.cookie=PLAY
+# application.session.maxAge=1h
+# application.session.secure=false
+
+# Session/Cookie sharing between subdomain
+# ~~~~~~~~~~~~~~~~~~~~~~
+# By default a cookie is only valid for a specific domain. By setting
+# application.defaultCookieDomain to '.example.com', the cookies
+# will be valid for all domains ending with '.example.com', ie:
+# foo.example.com and bar.example.com
+# application.defaultCookieDomain=.example.com
+
+# JVM configuration
+# ~~~~~
+# Define which port is used by JPDA when application is in debug mode (default is set to 8000)
+# jpda.port=8000
+#
+# Java source level => 1.5, 1.6 or 1.7 (experimental)
+# java.source=1.5
+
+# Log level
+# ~~~~~
+# Specify log level for your application.
+# If you want a very customized log, create a log4j.properties file in the conf directory
+application.log=DEBUG
+#
+# More logging configuration
+# application.log.path=/log4j.properties
+# application.log.system.out=off
+
+# Database configuration
+# ~~~~~
+# Enable a database engine if needed.
+#
+# To quickly set up a development database, use either:
+# - mem : for a transient in memory database (H2 in memory)
+# - fs : for a simple file written database (H2 file stored)
+db=mem
+#
+# To connect to a local MySQL5 database, use:
+# db=mysql:user:pwd@database_name
+#
+# If you need a full JDBC configuration use the following :
+# db.url=jdbc:postgresql:database_name
+# db.driver=org.postgresql.Driver
+# db.user=root
+# db.pass=secret
+#
+# Connections pool configuration :
+# db.pool.timeout=1000
+# db.pool.maxSize=30
+# db.pool.minSize=10
+#
+# If you want to reuse an existing Datasource from your application server, use:
+# db=java:/comp/env/jdbc/myDatasource
+#
+# When using an existing Datasource, it's sometimes needed to destroy it when
+# the application is stopped. Depending on the datasource, you can define a
+# generic "destroy" method :
+# db.destroyMethod=close
+
+# JPA Configuration (Hibernate)
+# ~~~~~
+#
+# Specify the custom JPA dialect to use here (default to guess):
+# jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
+#
+# Specify the ddl generation pattern to use. Set to none to disable it
+# (default to update in DEV mode, and none in PROD mode):
+# jpa.ddl=update
+#
+# Debug SQL statements (logged using DEBUG level):
+# jpa.debugSQL=true
+#
+# You can even specify additional hibernate properties here:
+# hibernate.use_sql_comments=true
+# ...
+#
+# Store path for Blob content
+attachments.path=data/attachments
+
+# Memcached configuration
+# ~~~~~
+# Enable memcached if needed. Otherwise a local cache is used.
+# memcached=enabled
+#
+# Specify memcached host (default to 127.0.0.1:11211)
+# memcached.host=127.0.0.1:11211
+#
+# Or you can specify multiple host to build a distributed cache
+# memcached.1.host=127.0.0.1:11211
+# memcached.2.host=127.0.0.1:11212
+
+# HTTP Response headers control for static files
+# ~~~~~
+# Set the default max-age, telling the user's browser how long it should cache the page.
+# Default is 3600 (one hour). Set it to 0 to send no-cache.
+# This is only read in prod mode, in dev mode the cache is disabled.
+# http.cacheControl=3600
+
+# If enabled, Play will generate entity tags automatically and send a 304 when needed.
+# Default is true, set it to false to deactivate use of entity tags.
+# http.useETag=true
+
+# Custom mime types
+# mimetype.xpi=application/x-xpinstall
+
+# WS configuration
+# ~~~~~
+# Default engine is Async Http Client, uncomment to use
+# the JDK's internal implementation
+# webservice = urlfetch
+# If you need to set proxy params for WS requests
+# http.proxyHost = localhost
+# http.proxyPort = 3128
+# http.proxyUser = jojo
+# http.proxyPassword = jojo
+
+# Mail configuration
+# ~~~~~
+# Default is to use a mock Mailer
+mail.smtp=mock
+
+# Or, specify mail host configuration
+# mail.smtp.host=127.0.0.1
+# mail.smtp.user=admin
+# mail.smtp.pass=
+# mail.smtp.channel=ssl
+
+# Url-resolving in Jobs
+# ~~~~~~
+# When rendering templates with reverse-url-resoling (@@{..}) in Jobs (which do not have an inbound Http.Request),
+# ie if sending a HtmlMail, Play need to know which url your users use when accessing your app.
+# %test.application.baseUrl=http://localhost:9000/
+# %prod.application.baseUrl=http://www.yourdomain.com/
+
+# Jobs executor
+# ~~~~~~
+# Size of the Jobs pool
+# play.jobs.pool=10
+
+# Execution pool
+# ~~~~~
+# Default to 1 thread in DEV mode or (nb processors + 1) threads in PROD mode.
+# Try to keep a low as possible. 1 thread will serialize all requests (very useful for debugging purpose)
+play.pool=3
+
+# Open file from errors pages
+# ~~~~~
+# If your text editor supports opening files by URL, Play! will
+# dynamically link error pages to files
+#
+# Example, for textmate:
+# play.editor=txmt://open?url=file://%s&line=%s
+
+# Testing. Set up a custom configuration for test mode
+# ~~~~~
+#%test.module.cobertura=${play.path}/modules/cobertura
+%test.application.mode=dev
+%test.db.url=jdbc:h2:mem:play;MODE=MYSQL;LOCK_MODE=0
+%test.jpa.ddl=create
+%test.mail.smtp=mock
+
+%stage.db=mysql:portal:portal@portal2
+
+#Dev
+oauth.twitter.consumer.key=yte4X9S7vZ0Ps9FrxbJNw
+oauth.twitter.consumer.secret=5ztJ0CWbpqAuvpUuTEff4AKJyOAWeZ9AugSQlZWmc
+oauth.facebook.app.id=241597489235844
+oauth.facebook.app.secret=e41aba4f9235a5d3717e3c229ddd3ca0
+
+# Recette
+%stage.oauth.twitter.consumer.key=052fwFjxjTZpgplD3r89wA
+%stage.oauth.twitter.consumer.secret=BODY29CPMLc2l8FDejmhbZvjvTMM6ypI4XkZp4GqA
+%stage.oauth.facebook.app.id=137228743041749
+%stage.oauth.facebook.app.secret=fff384cca50e288a7a3d0f21d046d43d
+
+#OxylaneID conf
+public.key.path=modules/geonaute/conf/publickey.inte.der
+linkdata.baseUrl=http://dev.linkdata.geonaute.com
+linkdata.partnerId=2
+linkdata.partnerKey=x2dNYsJLYnWHGd8Sh1h1
+
+application.js.compile=false
+%stage.application.js.compile=true
+
+# Config for Swarm
+#oauthlogin.id=mygeonautedev
+#oauthlogin.secret=pafpasteque
+#oauthlogin.baseUrl=http://swarm.local:9005
+#oauthlogin.accessToken=http://swarm.local:9005/oauth/accessToken
+#oauthlogin.authorizeUrl=http://swarm.local:9005/oauth/authorize
+
+# mygeonautedev => when the application runs on localhost
+oauthlogin.id=mygeonautedev
+oauthlogin.secret=pafpasteque
+oauthlogin.baseUrl=http://account.geonaute.znx.fr
+oauthlogin.accessToken=http://account.geonaute.znx.fr/oauth/accessToken
+oauthlogin.authorizeUrl=http://account.geonaute.znx.fr/oauth/authorize
+
+# mygeonaute => when the application runs on the staging server
+%stage.oauthlogin.id=mygeonaute
+
+application.onconnect.url=http://cdn.geonaute.zenexity.com/onConnect-20120131_2.exe
View
BIN samples/logit.jar
Binary file not shown.

0 comments on commit 6dffc9a

Please sign in to comment.