Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
15782bbf
Commit
15782bbf
authored
Dec 21, 2011
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix log recording and output
R=golang-dev, dsymonds CC=golang-dev
https://golang.org/cl/5503054
parent
9f0e39b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
build.go
misc/dashboard/app/build/build.go
+5
-4
test.go
misc/dashboard/app/build/test.go
+2
-2
No files found.
misc/dashboard/app/build/build.go
View file @
15782bbf
...
...
@@ -176,7 +176,7 @@ type Result struct {
GoHash
string
OK
bool
Log
[]
byte
`datastore:"-"`
// for JSON unmarshaling
Log
string
`datastore:"-"`
// for JSON unmarshaling only
LogHash
string
`datastore:",noindex"`
// Key to the Log record.
}
...
...
@@ -208,12 +208,12 @@ type Log struct {
CompressedLog
[]
byte
}
func
PutLog
(
c
appengine
.
Context
,
text
[]
byte
)
(
hash
string
,
err
os
.
Error
)
{
func
PutLog
(
c
appengine
.
Context
,
text
string
)
(
hash
string
,
err
os
.
Error
)
{
h
:=
sha1
.
New
()
h
.
Write
(
text
)
io
.
WriteString
(
h
,
text
)
b
:=
new
(
bytes
.
Buffer
)
z
,
_
:=
gzip
.
NewWriterLevel
(
b
,
gzip
.
BestCompression
)
z
.
Write
(
text
)
io
.
WriteString
(
z
,
text
)
z
.
Close
()
hash
=
fmt
.
Sprintf
(
"%x"
,
h
.
Sum
())
key
:=
datastore
.
NewKey
(
c
,
"Log"
,
hash
,
0
,
nil
)
...
...
@@ -511,6 +511,7 @@ func resultHandler(r *http.Request) (interface{}, os.Error) {
// logHandler displays log text for a given hash.
// It handles paths like "/log/hash".
func
logHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
Header
()
.
Set
(
"Content-type"
,
"text/plain"
)
c
:=
appengine
.
NewContext
(
r
)
h
:=
r
.
URL
.
Path
[
len
(
"/log/"
)
:
]
k
:=
datastore
.
NewKey
(
c
,
"Log"
,
h
,
0
,
nil
)
...
...
misc/dashboard/app/build/test.go
View file @
15782bbf
...
...
@@ -90,7 +90,7 @@ var testRequests = []struct {
{
"/todo"
,
url
.
Values
{
"kind"
:
{
"build-go-commit"
},
"builder"
:
{
"linux-386"
}},
nil
,
&
Todo
{
Kind
:
"build-go-commit"
,
Data
:
&
Commit
{
Hash
:
"0003"
}}},
// logs
{
"/result"
,
nil
,
&
Result
{
Builder
:
"linux-386"
,
Hash
:
"0003"
,
OK
:
false
,
Log
:
[]
byte
(
"test"
)
},
nil
},
{
"/result"
,
nil
,
&
Result
{
Builder
:
"linux-386"
,
Hash
:
"0003"
,
OK
:
false
,
Log
:
"test"
},
nil
},
{
"/log/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
,
nil
,
nil
,
"test"
},
{
"/todo"
,
url
.
Values
{
"kind"
:
{
"build-go-commit"
},
"builder"
:
{
"linux-386"
}},
nil
,
nil
},
...
...
@@ -106,7 +106,7 @@ var testRequests = []struct {
{
"/result"
,
nil
,
&
Result
{
PackagePath
:
testPkg
,
Builder
:
"linux-386"
,
Hash
:
"1001"
,
GoHash
:
"0001"
,
OK
:
true
},
nil
},
{
"/todo"
,
url
.
Values
{
"kind"
:
{
"build-package"
},
"builder"
:
{
"linux-386"
},
"packagePath"
:
{
testPkg
},
"goHash"
:
{
"0001"
}},
nil
,
nil
},
{
"/todo"
,
url
.
Values
{
"kind"
:
{
"build-package"
},
"builder"
:
{
"linux-386"
},
"packagePath"
:
{
testPkg
},
"goHash"
:
{
"0002"
}},
nil
,
&
Todo
{
Kind
:
"build-package"
,
Data
:
&
Commit
{
Hash
:
"1003"
}}},
{
"/result"
,
nil
,
&
Result
{
PackagePath
:
testPkg
,
Builder
:
"linux-386"
,
Hash
:
"1001"
,
GoHash
:
"0005"
,
OK
:
false
,
Log
:
[]
byte
(
"boo"
)
},
nil
},
{
"/result"
,
nil
,
&
Result
{
PackagePath
:
testPkg
,
Builder
:
"linux-386"
,
Hash
:
"1001"
,
GoHash
:
"0005"
,
OK
:
false
,
Log
:
"boo"
},
nil
},
}
func
testHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment