Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10592470
log.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
843 B
Subscribers
None
log.go
View Options
// 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
)
}
// 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
{})
{
// 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/plain
Expires
Sun, Apr 27, 9:53 AM (2 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3215153
Attached To
rWC Write.as Web Core
Event Timeline
Log In to Comment