Skip to content

Commit

Permalink
add some logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanHenson committed Oct 5, 2023
1 parent b9f2de1 commit c0ac6f5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions bin/system_info/print_system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@

#include <aws/common/system_info.h>
#include <aws/common/byte_buf.h>
#include <aws/common/logging.h>

int main(void) {
struct aws_allocator *allocator = aws_default_allocator();
aws_common_library_init(allocator);
struct aws_logger_standard_options options = {
.file = stderr,
.level = AWS_LOG_LEVEL_TRACE,
};

struct aws_logger logger;
aws_logger_init_standard(&logger, allocator, &options);
aws_logger_set(&logger);

struct aws_system_environment *env = aws_system_environment_load(allocator);

fprintf(stdout, "crt-detected env: {\n");
Expand All @@ -24,5 +35,8 @@ int main(void) {

fprintf(stdout, "}\n");
aws_system_environment_destroy(env);
aws_logger_clean_up(&logger);

aws_common_library_clean_up();
return 0;
}
3 changes: 2 additions & 1 deletion source/system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ void aws_system_environment_destroy(struct aws_system_environment *env) {
}

struct aws_byte_cursor aws_system_environment_get_virtualization_vendor(struct aws_system_environment *env) {
return aws_byte_cursor_from_buf(&env->virtualization_vendor);
struct aws_byte_cursor vendor_string = aws_byte_cursor_from_buf(&env->virtualization_vendor);
return aws_byte_cursor_trim_pred(&vendor_string, aws_char_is_space);
}

size_t aws_system_environment_get_processor_count(struct aws_system_environment *env) {
Expand Down

0 comments on commit c0ac6f5

Please sign in to comment.