mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-05-28 16:09:48 +00:00
24 lines
418 B
Go
24 lines
418 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
var currentProgram *Program
|
|
|
|
func log(msg string, args ...interface{}) {
|
|
var formattedMsg string
|
|
if len(args) > 0 {
|
|
formattedMsg = fmt.Sprintf(msg, args...)
|
|
fmt.Println(formattedMsg)
|
|
} else {
|
|
formattedMsg = msg
|
|
fmt.Println(msg)
|
|
}
|
|
|
|
if currentProgram != nil && currentProgram.LogsChannel != nil {
|
|
select {
|
|
case currentProgram.LogsChannel <- formattedMsg:
|
|
default:
|
|
}
|
|
}
|
|
}
|