aboutsummaryrefslogtreecommitdiff
path: root/logging
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-04-25 17:53:41 -0400
committerGalen Guyer <galen@galenguyer.com>2022-04-25 17:53:41 -0400
commit0c4683edc39489bb27e5df6b202f6691f892cdf2 (patch)
tree8030e59954824aefc54daaab073d24f7840266ea /logging
re-write vote in go with full functionality
Diffstat (limited to 'logging')
-rw-r--r--logging/logger.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/logging/logger.go b/logging/logger.go
new file mode 100644
index 0000000..3956b17
--- /dev/null
+++ b/logging/logger.go
@@ -0,0 +1,27 @@
+package logging
+
+import (
+ "os"
+ "runtime"
+
+ "github.com/sirupsen/logrus"
+)
+
+var Logger = &logrus.Logger{
+ Out: os.Stdout,
+ Formatter: &logrus.TextFormatter{
+ DisableLevelTruncation: true,
+ PadLevelText: true,
+ FullTimestamp: true,
+ },
+ Hooks: make(logrus.LevelHooks),
+ Level: logrus.InfoLevel,
+}
+
+func Trace() runtime.Frame {
+ pc := make([]uintptr, 15)
+ n := runtime.Callers(2, pc)
+ frames := runtime.CallersFrames(pc[:n])
+ frame, _ := frames.Next()
+ return frame
+}