Merge branch 'func_logs2' into 'master'

Func logs feature

See merge request !66
This commit is contained in:
Travis Reeder
2017-06-20 11:51:26 -07:00
39 changed files with 783 additions and 140 deletions

View File

@@ -0,0 +1,8 @@
FROM funcy/go:dev as build-stage
WORKDIR /function
ADD . /src
RUN cd /src && go build -o func
FROM funcy/go
WORKDIR /function
COPY --from=build-stage /src/func /function/
ENTRYPOINT ["./func"]

View File

@@ -0,0 +1,5 @@
name: funcy/stderr-logging
version: 0.0.1
runtime: go
entrypoint: ./func
path: /stderr-logging

View File

@@ -0,0 +1,29 @@
package main
import (
"fmt"
"encoding/json"
"os"
"math/rand"
)
const lBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
type OutputSize struct {
Size int `json:"size"`
}
func RandStringBytes(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = lBytes[rand.Intn(len(lBytes))]
}
return string(b)
}
func main() {
out := &OutputSize{Size: 64 * 1024}
json.NewDecoder(os.Stdin).Decode(out)
fmt.Fprintln(os.Stderr, RandStringBytes(out.Size))
}

View File

@@ -0,0 +1,3 @@
{
"size": 8
}