Exercise 2 completed

This commit is contained in:
cdricms
2024-04-30 02:39:46 +02:00
parent d482092764
commit 4a2d726e70
6 changed files with 155 additions and 0 deletions

21
ex2/logger.go Normal file
View File

@@ -0,0 +1,21 @@
package main
type Log struct {
Msg string
}
type Logs []Log
var LogList Logs
func (ll *Logs) Log(msg string) {
*ll = append(*ll, Log{msg})
}
func (ll Logs) ToString() string {
res := ""
for _, log := range ll {
res += log.Msg + "\n"
}
return res
}