src-d / borges

borges collects and stores Git repositories.
https://docs.sourced.tech/borges/
GNU General Public License v3.0
52 stars 20 forks source link

borges: print endpoint in logs as soon as possible #329

Closed jfontan closed 6 years ago

jfontan commented 6 years ago

The endpoint was only logged after the repository clone ended. If there is a problem before that there was no information to which repo a log line belongs.

It also adds endpoint info to the final log message of the job if available (either error or success).

$ LOG_LEVEL=debug go run -tags norwfs cli/borges/* pack --to siva4 -f list3 --workers=1 
[2018-08-16T11:47:50.758446877+02:00] DEBUG queueing jobs source=borges/executor.go:63
[2018-08-16T11:47:50.758463385+02:00] DEBUG starting source=borges/worker.go:47 worker=0
[2018-08-16T11:47:50.758580589+02:00] DEBUG jobs queued jobs=1 source=borges/executor.go:68
[2018-08-16T11:47:50.758663409+02:00] DEBUG job started job=01654222-5466-ad10-f8e9-a5ed927252c5 source=borges/archiver.go:102
[2018-08-16T11:47:50.758721509+02:00] DEBUG repository model obtained endpoints=[https://github.com/jfontan/cangallo.git] job=01654222-5466-ad10-f8e9-a5ed927252c5 last-fetch=<nil> references=0 source=borges/archiver.go:142 status=pending
[2018-08-16T11:47:50.758769607+02:00]  INFO clone started endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 source=borges/archiver.go:159
[2018-08-16T11:47:51.927245988+02:00] DEBUG remote repository cloned source=borges/archiver.go:170
[2018-08-16T11:47:51.95033298+02:00] DEBUG changes obtained endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 roots=1 source=borges/archiver.go:231
[2018-08-16T11:47:51.950497314+02:00] DEBUG push changes to rooted repository started endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 root=674cb5ef2dede08215193991c2127e521def049f source=borges/archiver.go:337
[2018-08-16T11:47:51.950842763+02:00] DEBUG copy siva file from FS duration=233.581µs endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 root=674cb5ef2dede08215193991c2127e521def049f rooted-repository=674cb5ef2dede08215193991c2127e521def049f source=borges/archiver.go:406
[2018-08-16T11:47:52.098577293+02:00] DEBUG one change pushed duration=0 endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 root=674cb5ef2dede08215193991c2127e521def049f rooted-repository=674cb5ef2dede08215193991c2127e521def049f source=borges/archiver.go:438
[2018-08-16T11:47:52.099074446+02:00] DEBUG copy siva file to FS duration=431.167µs endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 root=674cb5ef2dede08215193991c2127e521def049f rooted-repository=674cb5ef2dede08215193991c2127e521def049f source=borges/archiver.go:451
[2018-08-16T11:47:52.099112586+02:00] DEBUG push changes to rooted repository finished endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 root=674cb5ef2dede08215193991c2127e521def049f source=borges/archiver.go:349
[2018-08-16T11:47:52.099136021+02:00] DEBUG update repository references started endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 root=674cb5ef2dede08215193991c2127e521def049f source=borges/archiver.go:350
[2018-08-16T11:47:52.099172347+02:00] DEBUG update repository references finished endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 root=674cb5ef2dede08215193991c2127e521def049f source=borges/archiver.go:362
[2018-08-16T11:47:52.099770721+02:00] DEBUG repository processed endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 source=borges/archiver.go:134 status=fetched
[2018-08-16T11:47:52.100040585+02:00]  INFO job finished successfully endpoint=https://github.com/jfontan/cangallo.git job=01654222-5466-ad10-f8e9-a5ed927252c5 source=borges/archiver.go:113

Fixes #325