1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. 7 */ 8 9 #include <functional> 10 #include <string> 11 #include <vector> 12 13 #include <executorch/runtime/platform/log.h> 14 #include <executorch/runtime/platform/platform.h> 15 #include <executorch/runtime/platform/runtime.h> 16 17 namespace executorch::extension { 18 struct log_entry { 19 et_timestamp_t timestamp; 20 et_pal_log_level_t level; 21 std::string filename; 22 std::string function; 23 size_t line; 24 std::string message; 25 log_entrylog_entry26 log_entry( 27 et_timestamp_t timestamp, 28 et_pal_log_level_t level, 29 const char* filename, 30 const char* function, 31 size_t line, 32 const char* message, 33 size_t length) 34 : timestamp(timestamp), 35 level(level), 36 filename(filename), 37 function(function), 38 line(line), 39 message(message, length) {} 40 }; 41 42 void access_log_buffer(std::function<void(std::vector<log_entry>&)> accessor); 43 } // namespace executorch::extension 44