func log(s ...interface{}) {
f, err := os.OpenFile("info.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
fmt.Printf("error opening log file: %v", err)
os.Exit(1)
}
defer f.Close()
log.SetOutput(f)
ss := ""
for _, p := range s {
switch p.(type) {
case bool:
ss += fmt.Sprintf("%t ", p.(bool))
case int:
ss += fmt.Sprintf("%d ", p.(int))
case float64:
ss += fmt.Sprintf("%.2f ", p.(float64))
case string:
ss += fmt.Sprintf("%s ", p.(string))
}
}
log.Println(ss)
}
Page Updates |
---|
Apache Bench load testing |
Console::Blackjack |
RetroPie Arcade |
Factorio on systemd |
Generate new Factorio map |
Recent Articles |
---|
Install xfce4 on Debian |
Console Blackjack in Perl |
Selenium::WebDriver::Error::UnknownError |
Game of Life in C++ using the SDL2 |
PigPen (dots and boxes) in C++ using the SDL2 |
Copyright © 2005 - 2021
All Rights Reserved