You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
710 B
49 lines
710 B
package main
|
|
|
|
import (
|
|
"alogs/ejson"
|
|
"errs"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
|
|
func Print (err error) {
|
|
if err != nil {
|
|
fmt.Print(errs.Encode(err,nil))
|
|
}
|
|
}
|
|
|
|
|
|
func Append (entry *alogs.Entry) error {
|
|
|
|
rs := ejson.EncodeEntry(entry)
|
|
if !rs.Ok() {
|
|
return rs.Fail()
|
|
}
|
|
fmt.Fprint(os.Stderr,string(rs.Value()))
|
|
fmt.Fprint(os.Stderr,"\n\n")
|
|
return nil
|
|
}
|
|
|
|
|
|
func main() {
|
|
|
|
l := alogs.NewLoggerManager("Main",alogs.LevelAll)
|
|
|
|
l.AddCore(alogs.NewLoggerCore("MiLogger",alogs.LevelAll,alogs.LoggerCoreWithAppender(alogs.AppendEntryFnc(Append))))
|
|
l.Start(true)
|
|
|
|
l.Warn("Esto es un mensage")
|
|
l.Error("Esto es un mensage",errs.ErrCode("UnError"))
|
|
l.Fatal("Fatalidad",errs.NewErrPanic(errs.ErrCode("unca cauisa")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|