Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10455874
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
diff --git a/log/log.go b/log/log.go
index ec37124..dac5925 100644
--- a/log/log.go
+++ b/log/log.go
@@ -1,27 +1,42 @@
// Package log prints different kinds of log messages in the formats we like.
package log
import (
+ "fmt"
"log"
"os"
+ "runtime"
)
var (
InfoLog *log.Logger
ErrorLog *log.Logger
)
func init() {
InfoLog = log.New(os.Stdout, "", log.Ldate|log.Ltime)
- ErrorLog = log.New(os.Stderr, "ERROR: ", log.Ldate|log.Ltime|log.Lshortfile)
+ ErrorLog = log.New(os.Stderr, "ERROR: ", log.Ldate|log.Ltime)
}
// Info logs an informational message to Stdout.
func Info(s string, v ...interface{}) {
InfoLog.Printf(s, v...)
}
// Error logs an error to Stderr.
func Error(s string, v ...interface{}) {
- ErrorLog.Printf(s, v...)
+ // Include original caller information
+ _, file, line, _ := runtime.Caller(1)
+
+ // Determine short filename (from standard log package)
+ short := file
+ for i := len(file) - 1; i > 0; i-- {
+ if file[i] == '/' {
+ short = file[i+1:]
+ break
+ }
+ }
+ file = short
+
+ ErrorLog.Printf(fmt.Sprintf("%s:%d: ", short, line)+s, v...)
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Feb 1, 4:40 AM (20 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3146034
Attached To
rWC Write.as Web Core
Event Timeline
Log In to Comment