Skip to content

Commit

Permalink
Merge pull request #234 from anzx/feature/logger-milliseconds
Browse files Browse the repository at this point in the history
Added milliseconds to logger
  • Loading branch information
hossarir authored Oct 11, 2021
2 parents 57fd5dd + a53aea2 commit 6f2fcc5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions syntax/std.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"log"
"math"
"os"
"strconv"
"sync"

Expand All @@ -25,6 +26,8 @@ var (
fix, fixt rel.Value
)

var logger = log.New(os.Stderr, "", log.Ldate|log.Lmicroseconds)

func FixFuncs() (rel.Value, rel.Value) {
fixOnce.Do(func() {
fix = mustParseLit(`(\f f(f))(\f \g \n g(f(f)(g))(n))`)
Expand Down Expand Up @@ -123,7 +126,7 @@ func SafeStdScopeTuple() rel.Tuple {
),
rel.NewTupleAttr("log",
rel.NewNativeFunctionAttr("print", func(_ context.Context, value rel.Value) (rel.Value, error) {
log.Print(fu.Repr(value))
logger.Print(fu.Repr(value))
return value, nil
}),
createFunc2Attr("printf", func(ctx context.Context, a, b rel.Value) (rel.Value, error) {
Expand All @@ -132,7 +135,7 @@ func SafeStdScopeTuple() rel.Tuple {
for i := b.(rel.Set).ArrayEnumerator(); i.MoveNext(); {
strs = append(strs, i.Current())
}
log.Printf(format, strs...)
logger.Printf(format, strs...)
return b, nil
}),
),
Expand Down

0 comments on commit 6f2fcc5

Please sign in to comment.