Skip to content

conn: change design of tarantool.Logger#518

Open
babyTsakhes wants to merge 1 commit intomasterfrom
babyTsakhes/gh-504-change-design-of-tarantool-Logger
Open

conn: change design of tarantool.Logger#518
babyTsakhes wants to merge 1 commit intomasterfrom
babyTsakhes/gh-504-change-design-of-tarantool-Logger

Conversation

@babyTsakhes
Copy link
Copy Markdown
Collaborator

conn: change design of tarantool.Logger

  • Changed the logging design, now it works with slog.
  • Changed the tests that tested logging.

Closes #504 .

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch from d32547b to 348e8dc Compare January 27, 2026 08:48
Comment thread connection.go Outdated
Comment thread connection.go Outdated
Comment thread connection.go Outdated
Comment thread connection.go
Comment thread connection_events.go Outdated
Comment thread logger.go Outdated
Comment thread logger.go Outdated
Comment thread logger.go Outdated
Comment thread connection_events.go Outdated
Comment thread connection.go
Comment thread connection.go
Comment thread logger/logger.go
@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch 2 times, most recently from f62a564 to c9ae3ec Compare February 16, 2026 17:22
@babyTsakhes
Copy link
Copy Markdown
Collaborator Author

RUN TestGracefulShutdownWithReconnect
2026-02-16T18:43:58.4159790Z 2026/02/16 18:43:58 INFO connected component=tarantool.connection time=2026-02-16T18:43:58.415Z addr=127.0.0.1:3014 event=connected reconnects=0 connection_state=connected request_timeout=500ms
2026-02-16T18:43:58.4162723Z 2026/02/16 18:43:58 INFO closed component=tarantool.connection time=2026-02-16T18:43:58.415Z addr=127.0.0.1:3014 event=closed connection_state=closed request_timeout=500ms
2026-02-16T18:43:58.4174785Z 2026/02/16 18:43:58 INFO connected component=tarantool.connection time=2026-02-16T18:43:58.417Z addr=127.0.0.1:3014 event=connected reconnects=0 connection_state=connected max_reconnects=10 reconnect_interval=500ms request_timeout=20s
2026-02-16T18:43:59.4191131Z 2026/02/16 18:43:59 WARN disconnected component=tarantool.connection time=2026-02-16T18:43:59.418Z addr=127.0.0.1:3014 reason="connection closed after server shutdown (0x4001)" connection_state=disconnected max_reconnects=10 reconnect_interval=500ms request_timeout=20s
2026-02-16T18:43:59.4195050Z 2026/02/16 18:43:59 ERROR reconnect_failed component=tarantool.connection time=2026-02-16T18:43:59.418Z addr=127.0.0.1:3014 event=reconnect_failed reconnects=0 max_reconnects=10 error="failed to dial: dial tcp 127.0.0.1:3014: connect: connection refused" is_initial=false connection_state=disconnected reconnect_interval=500ms request_timeout=20s
2026-02-16T18:43:59.4217329Z 2026/02/16 18:43:59 Tarantool "127.0.0.1:3014" was unexpectedly terminated:
2026-02-16T18:43:59.5238013Z 2026/02/16 18:43:59 INFO connected component=tarantool.connection time=2026-02-16T18:43:59.523Z addr=127.0.0.1:3014 event=connected reconnects=0 connection_state=connected request_timeout=500ms
2026-02-16T18:43:59.5240208Z 2026/02/16 18:43:59 INFO closed component=tarantool.connection time=2026-02-16T18:43:59.523Z addr=127.0.0.1:3014 event=closed connection_state=closed request_timeout=500ms
2026-02-16T18:43:59.9199004Z 2026/02/16 18:43:59 INFO connected component=tarantool.connection time=2026-02-16T18:43:59.919Z addr=127.0.0.1:3014 event=connected reconnects=1 connection_state=connected max_reconnects=10 reconnect_interval=500ms request_timeout=20s
2026-02-16T18:44:01.0256388Z 2026/02/16 18:44:01 WARN disconnected component=tarantool.connection time=2026-02-16T18:44:01.025Z addr=127.0.0.1:3014 reason="connection closed after server shutdown (0x4001)" connection_state=disconnected max_reconnects=10 reconnect_interval=500ms request_timeout=20s
2026-02-16T18:44:01.0259814Z 2026/02/16 18:44:01 ERROR reconnect_failed component=tarantool.connection time=2026-02-16T18:44:01.025Z addr=127.0.0.1:3014 event=reconnect_failed reconnects=0 max_reconnects=10 error="failed to dial: dial tcp 127.0.0.1:3014: connect: connection refused" is_initial=false connection_state=disconnected reconnect_interval=500ms request_timeout=20s
2026-02-16T18:44:01.0283910Z 2026/02/16 18:44:01 Tarantool "127.0.0.1:3014" was unexpectedly terminated:
2026-02-16T18:44:01.0285655Z 2026/02/16 18:44:01 INFO closed component=tarantool.connection time=2026-02-16T18:44:01.028Z addr=127.0.0.1:3014 event=closed connection_state=closed max_reconnects=10 reconnect_interval=500ms request_timeout=20s
2026-02-16T18:44:01.0287093Z --- PASS: TestGracefulShutdownWithReconnect (2.72s)
2026-02-16T18:44:01.0287653Z === RUN TestNoGracefulShutdown
2026-02-16T18:44:01.0332295Z shutdown_test.go:215: Skipping test for Tarantool with watchers support
2026-02-16T18:44:01.0333012Z --- SKIP: TestNoGracefulShutdown (0.00s)
2026-02-16T18:44:01.0333536Z === RUN TestGracefulShutdownRespectsClose
2026-02-16T18:44:01.1385437Z 2026/02/16 18:44:01 INFO connected component=tarantool.connection time=2026-02-16T18:44:01.138Z addr=127.0.0.1:3014 event=connected reconnects=0 connection_state=connected request_timeout=500ms
2026-02-16T18:44:01.1388208Z 2026/02/16 18:44:01 INFO closed component=tarantool.connection time=2026-02-16T18:44:01.138Z addr=127.0.0.1:3014 event=closed connection_state=closed request_timeout=500ms
2026-02-16T18:44:01.1400372Z 2026/02/16 18:44:01 INFO connected component=tarantool.connection time=2026-02-16T18:44:01.139Z addr=127.0.0.1:3014 event=connected reconnects=0 connection_state=connected max_reconnects=10 reconnect_interval=500ms request_timeout=20s
2026-02-16T18:44:01.1409122Z 2026/02/16 18:44:01 INFO closed component=tarantool.connection time=2026-02-16T18:44:01.140Z addr=127.0.0.1:3014 event=closed connection_state=closed max_reconnects=10 reconnect_interval=500ms request_timeout=20s
2026-02-16T18:44:01.1435346Z 2026/02/16 18:44:01 Tarantool "127.0.0.1:3014" was unexpectedly terminated:
2026-02-16T18:44:01.1437681Z --- PASS: TestGracefulShutdownRespectsClose (0.11s)
2026-02-16T18:44:01.1438563Z === RUN TestGracefulShutdownNotRacesWithRequestReconnect
2026-02-16T18:44:01.2502802Z 2026/02/16 18:44:01 INFO connected component=tarantool.connection time=2026-02-16T18:44:01.249Z addr=127.0.0.1:3014 event=connected reconnects=0 connection_state=connected request_timeout=500ms
2026-02-16T18:44:01.2504757Z 2026/02/16 18:44:01 INFO closed component=tarantool.connection time=2026-02-16T18:44:01.250Z addr=127.0.0.1:3014 event=closed connection_state=closed request_timeout=500ms
2026-02-16T18:44:01.2510331Z 2026/02/16 18:44:01 INFO connected component=tarantool.connection time=2026-02-16T18:44:01.250Z addr=127.0.0.1:3014 event=connected reconnects=0 connection_state=connected max_reconnects=10 reconnect_interval=500ms request_timeout=20s
2026-02-16T18:44:02.2558694Z 2026/02/16 18:44:02 WARN disconnected component=tarantool.connection time=2026-02-16T18:44:02.255Z addr=127.0.0.1:3014 reason="failed to read data from the connection: EOF (0x4006)" connection_state=disconnected max_reconnects=10 reconnect_interval=500ms request_timeout=20s

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch 2 times, most recently from cd1f671 to 41cc5b0 Compare February 22, 2026 22:03
@babyTsakhes
Copy link
Copy Markdown
Collaborator Author

I deleted reconnects count, and deleted event ReconnectedEvent.

@babyTsakhes
Copy link
Copy Markdown
Collaborator Author

Please, take a look.

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch from 41cc5b0 to 64458cf Compare February 22, 2026 22:15
Comment thread connection_events.go
Comment thread connection_events.go Outdated
Comment thread logger.go Outdated
Comment thread logger/logger.go
Comment thread connection.go Outdated
Comment thread connection.go
Comment thread connection_events.go
Comment thread connection_events.go
Comment thread connection_events.go Outdated
Comment thread connection.go Outdated
@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch from c13dd6e to 9f8bc91 Compare March 4, 2026 22:17
@bigbes bigbes self-requested a review March 5, 2026 15:23
Comment thread connection.go
return "unknown"
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func (s *ConnectionState) Is(other ConnectionState) bool {
    return atomic.LoadUint32(s) == uint32(other)
}

func (s *ConnectionState) Set(new ConnectionState) bool {
    ...
}

Comment thread connection.go Outdated
// ConnectedNow reports if connection is established at the moment.
func (conn *Connection) ConnectedNow() bool {
return atomic.LoadUint32(&conn.state) == connConnected
return ConnectionState(atomic.LoadUint32(&conn.state)) == StateConnected
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conn.state.Is(StateConnected)

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch 2 times, most recently from aae8f3d to 3c973bd Compare March 19, 2026 11:07
@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch from 780a1bc to cbc82d9 Compare March 19, 2026 14:40
@babyTsakhes
Copy link
Copy Markdown
Collaborator Author

Do buffer without time in example-test.

@babyTsakhes
Copy link
Copy Markdown
Collaborator Author

FAIL: ExampleNewSlogLogger (0.00s)
2026-03-19T19:52:44.4921283Z got:
2026-03-19T19:52:44.4922314Z time=TIME level=INFO msg="Connected to Tarantool" component=tarantool.connection event_time=TIME event=connected addr=127.0.0.1:port connection_state=connected
2026-03-19T19:52:44.4923562Z want:
2026-03-19T19:52:44.4924106Z time=TIME level=INFO msg="Connected to Tarantool" component=tarantool.connection
2026-03-19T19:52:44.4924993Z event_time=TIME event=connected addr=127.0.0.1:port connection_state=connected

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch 2 times, most recently from 286fdaa to 8ce702a Compare March 22, 2026 21:47
@babyTsakhes
Copy link
Copy Markdown
Collaborator Author

Merge conflict

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch from 8ecdf48 to e23be6f Compare March 22, 2026 22:22
@babyTsakhes
Copy link
Copy Markdown
Collaborator Author

Please take a look. Please be careful, I fixed the conflict in the connection.go, tarantool_test.go files.

@babyTsakhes
Copy link
Copy Markdown
Collaborator Author

Now I'm changing this code with the new requirements.

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch from e23be6f to 8681cbc Compare April 7, 2026 14:01
We have used the slog library, and now the messages are more informative.

Closes #504
@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-504-change-design-of-tarantool-Logger branch from 61b05d9 to 4f521a8 Compare April 16, 2026 12:44
@babyTsakhes
Copy link
Copy Markdown
Collaborator Author

babyTsakhes commented Apr 16, 2026

I think we need addrs x 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v3: change design of tarantool.Logger

2 participants