14 lines
525 B
Python
14 lines
525 B
Python
p = r"E:\GitHub\blog\bot-go\cmd\writebot\main.go"
|
|||
|
|
with open(p, "r", encoding="utf-8") as f:
|
||
|
|
c = f.read()
|
||
|
|
|
||
|
|
# Replace logutil.Init + log = logutil.Logger with inline
|
||
|
|
c = c.replace(
|
||
|
|
'logutil.Init("writebot")\n\tlog = logutil.Logger',
|
||
|
|
'log = slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelInfo})).With("svc", "writebot")'
|
||
|
|
)
|
||
|
|
c = c.replace('\t"writebot/internal/logutil"\n', '')
|
||
|
|
|
||
|
|
with open(p, "w", encoding="utf-8", newline="\n") as f:
|
||
|
|
f.write(c)
|
||
|
|
print("Fixed bot-go inline slog")
|