Skip to content

Added code to output libSession logs - #997

Merged
mpretty-cyro merged 2 commits into
session-foundation:release/1.21.0from
mpretty-cyro:feature/libsession-logging
Mar 4, 2025
Merged

Added code to output libSession logs#997
mpretty-cyro merged 2 commits into
session-foundation:release/1.21.0from
mpretty-cyro:feature/libsession-logging

Conversation

@mpretty-cyro

Copy link
Copy Markdown
Collaborator

This PR adds a wrapper around the libSession logging code routing logs from within libSession to come out via __android_log_print - can be setup by calling Logger.initLogger() somewhere (for testing I had it within the ConfigFactory init but wasn't sure where or if these logs were desired so haven't included the init call for now)

@mpretty-cyro mpretty-cyro self-assigned this Mar 3, 2025
@mpretty-cyro
mpretty-cyro force-pushed the feature/libsession-logging branch from e4a442a to 3a339b1 Compare March 3, 2025 06:43
break;
}

__android_log_print(prio, LOG_TAG, "%.*s [%.*s]",

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.

Nice! Didn't know %.*s exists

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Mm yea pretty convenience 😁

Comment thread libsession-util/src/main/cpp/logging.h Outdated

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.

FYI there's actually no need to have this header file, given you aren't referencing this JNI method else where in C++ land, as long as the symbol is marked as JNIEXPORT it is all good to go.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ah nice, I'll remove it then

@mpretty-cyro
mpretty-cyro merged commit 83e9f8e into session-foundation:release/1.21.0 Mar 4, 2025
@mpretty-cyro
mpretty-cyro deleted the feature/libsession-logging branch March 4, 2025 21:27
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.

2 participants