brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | #include <getopt.h> |
| 4 | #include <sys/types.h> |
| 5 | #include <sys/stat.h> |
| 6 | #include <fcntl.h> |
| 7 | #include <inttypes.h> |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 8 | |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 9 | #include <algorithm> |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 10 | #include <memory> |
| 11 | #include <string> |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 12 | |
Brian Silverman | fe9b7a2 | 2014-02-10 15:03:42 -0800 | [diff] [blame] | 13 | #include "aos/linux_code/logging/binary_log_file.h" |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 14 | #include "aos/common/queue_types.h" |
Brian Silverman | a7234c6 | 2014-03-24 20:23:25 -0700 | [diff] [blame] | 15 | #include "aos/common/logging/logging_impl.h" |
| 16 | #include "aos/common/logging/logging_printf_formats.h" |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 17 | #include "aos/common/util/string_to_num.h" |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 18 | |
| 19 | using ::aos::logging::linux_code::LogFileMessageHeader; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 20 | |
| 21 | namespace { |
| 22 | |
| 23 | const char *kArgsHelp = "[OPTION]... [FILE]\n" |
| 24 | "Display log file FILE (created by BinaryLogReader) to stdout.\n" |
| 25 | "FILE is \"aos_log-current\" by default.\n" |
| 26 | "\n" |
| 27 | " -n, --name NAME only display entries from processes named NAME\n" |
| 28 | " -l, --level LEVEL " |
| 29 | "only display log entries at least as important as LEVEL\n" |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 30 | " -p, --pid PID only display log entries from process PID\n" |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 31 | " -f, --follow " |
| 32 | "wait when the end of the file is reached (implies --end)\n" |
| 33 | " -t, --terminate stop when the end of file is reached (default)\n" |
| 34 | " -b, --beginning start at the beginning of the file (default)\n" |
| 35 | " -e, --end start at the end of the file\n" |
| 36 | " -s, --skip NUMBER skip NUMBER matching logs\n" |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 37 | " -m, --max NUMBER only display up to NUMBER logs\n" |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 38 | " // -o, --format FORMAT use FORMAT to display log entries\n" |
Brian Silverman | a52ba16 | 2013-02-28 15:01:12 -0800 | [diff] [blame] | 39 | " -h, --help display this help and exit\n" |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 40 | "\n" |
| 41 | "LEVEL must be DEBUG, INFO, WARNING, ERROR, or FATAL.\n" |
| 42 | " It defaults to INFO.\n" |
| 43 | "\n" |
Daniel Petti | e6f33e2 | 2014-08-21 20:35:55 -0700 | [diff] [blame] | 44 | "TODO(brians) implement the commented out ones.\n"; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 45 | |
Daniel Petti | 88c81f4 | 2014-09-12 10:05:05 -0700 | [diff] [blame^] | 46 | const char *kExampleUsages = "To view logs from the shooter:\n" |
| 47 | "\t`log_displayer -n shooter`\n" |
| 48 | "To view debug logs from the shooter:\n" |
| 49 | "\t`log_displayer -n shooter -l DEBUG`\n" |
| 50 | "To view what the shooter is logging in realtime:\n" |
| 51 | "\t`log_displayer -f -n shooter`\n" |
| 52 | "To view shooter logs from an old log file:\n" |
| 53 | "\t`log_displayer aos_log-<number> -n shooter`\n" |
| 54 | "To view the statuses of the shooter hall effects in realtime:\n" |
| 55 | "\t`log_displayer -f -n shooter -l DEBUG | grep .Position`\n"; |
| 56 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 57 | void PrintHelpAndExit() { |
| 58 | fprintf(stderr, "Usage: %s %s", program_invocation_name, kArgsHelp); |
Daniel Petti | 88c81f4 | 2014-09-12 10:05:05 -0700 | [diff] [blame^] | 59 | fprintf(stderr, "\nExample usages:\n\n%s", kExampleUsages); |
| 60 | |
| 61 | // Get the possible executables from start_list.txt. |
| 62 | FILE *start_list = fopen("start_list.txt", "r"); |
| 63 | if (start_list == NULL) { |
| 64 | PLOG(FATAL, "Unable to open start_list.txt"); |
| 65 | } |
| 66 | |
| 67 | // Get file size. |
| 68 | if (fseek(start_list, 0, SEEK_END)) { |
| 69 | PLOG(FATAL, "fseek() failed while reading start_list.txt"); |
| 70 | } |
| 71 | int size = ftell(start_list); |
| 72 | if (size < 0) { |
| 73 | PLOG(FATAL, "ftell() failed while reading start_list.txt"); |
| 74 | } |
| 75 | rewind(start_list); |
| 76 | |
| 77 | ::std::unique_ptr<char[]> contents(new char[size + 1]); |
| 78 | if (contents == NULL) { |
| 79 | LOG(FATAL, "malloc() failed while reading start_list.txt.\n"); |
| 80 | } |
| 81 | size_t bytes_read = fread(contents.get(), 1, size, start_list); |
| 82 | if (bytes_read < static_cast<size_t>(size)) { |
| 83 | LOG(FATAL, "Read %zu bytes from start_list.txt, expected %d.\n", |
| 84 | bytes_read, size); |
| 85 | } |
| 86 | |
| 87 | // printf doesn't like strings without the \0. |
| 88 | contents[size] = '\0'; |
| 89 | fprintf(stderr, "\nPossible arguments for the -n option:\n%s", contents.get()); |
| 90 | |
| 91 | if (fclose(start_list)) { |
| 92 | LOG(FATAL, "fclose() failed.\n"); |
| 93 | } |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 94 | |
| 95 | exit(EXIT_SUCCESS); |
| 96 | } |
| 97 | |
| 98 | } // namespace |
| 99 | |
| 100 | int main(int argc, char **argv) { |
| 101 | const char *filter_name = NULL; |
Brian Silverman | f778031 | 2014-02-16 17:26:15 -0800 | [diff] [blame] | 102 | size_t filter_length = 0; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 103 | log_level filter_level = INFO; |
Brian Silverman | f778031 | 2014-02-16 17:26:15 -0800 | [diff] [blame] | 104 | bool follow = false; |
| 105 | // Whether we need to skip everything until we get to the end of the file. |
| 106 | bool skip_to_end = false; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 107 | const char *filename = "aos_log-current"; |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 108 | int display_max = 0; |
| 109 | int32_t source_pid = -1; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 110 | |
Brian Silverman | ff48578 | 2014-06-18 19:59:09 -0700 | [diff] [blame] | 111 | ::aos::logging::Init(); |
Brian Silverman | f778031 | 2014-02-16 17:26:15 -0800 | [diff] [blame] | 112 | ::aos::logging::AddImplementation( |
| 113 | new ::aos::logging::StreamLogImplementation(stdout)); |
| 114 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 115 | while (true) { |
| 116 | static struct option long_options[] = { |
| 117 | {"name", required_argument, NULL, 'n'}, |
| 118 | {"level", required_argument, NULL, 'l'}, |
| 119 | {"pid", required_argument, NULL, 'p'}, |
| 120 | |
| 121 | {"follow", no_argument, NULL, 'f'}, |
| 122 | {"terminate", no_argument, NULL, 't'}, |
| 123 | {"beginning", no_argument, NULL, 'b'}, |
| 124 | {"end", no_argument, NULL, 'e'}, |
| 125 | {"skip", required_argument, NULL, 's'}, |
| 126 | {"max", required_argument, NULL, 'm'}, |
| 127 | |
| 128 | {"format", required_argument, NULL, 'o'}, |
| 129 | |
| 130 | {"help", no_argument, NULL, 'h'}, |
| 131 | {0, 0, 0, 0} |
| 132 | }; |
| 133 | int option_index = 0; |
| 134 | |
| 135 | const int c = getopt_long(argc, argv, "n:l:p:fts:m:o:h", |
| 136 | long_options, &option_index); |
| 137 | if (c == -1) { // if we're at the end |
| 138 | break; |
| 139 | } |
| 140 | switch (c) { |
| 141 | case 0: |
Daniel Petti | 88c81f4 | 2014-09-12 10:05:05 -0700 | [diff] [blame^] | 142 | fputs("LogDisplayer: got a 0 option but didn't set up any\n", stderr); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 143 | abort(); |
| 144 | case 'n': |
| 145 | filter_name = optarg; |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 146 | filter_length = strlen(filter_name); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 147 | break; |
| 148 | case 'l': |
Brian Silverman | ab6615c | 2013-03-05 20:29:29 -0800 | [diff] [blame] | 149 | filter_level = ::aos::logging::str_log(optarg); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 150 | if (filter_level == LOG_UNKNOWN) { |
| 151 | fprintf(stderr, "LogDisplayer: unknown log level '%s'\n", optarg); |
| 152 | exit(EXIT_FAILURE); |
| 153 | } |
| 154 | break; |
| 155 | case 'p': |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 156 | if (!::aos::util::StringToInteger(::std::string(optarg), &source_pid)) { |
| 157 | fprintf(stderr, "ERROR: -p expects a number, not '%s'.\n", optarg); |
| 158 | exit(EXIT_FAILURE); |
| 159 | } |
| 160 | if (source_pid < 0) { |
| 161 | fprintf(stderr, "LogDisplayer: invalid pid '%s'\n", optarg); |
| 162 | exit(EXIT_FAILURE); |
| 163 | } |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 164 | break; |
| 165 | case 'f': |
| 166 | follow = true; |
Brian Silverman | f778031 | 2014-02-16 17:26:15 -0800 | [diff] [blame] | 167 | skip_to_end = true; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 168 | break; |
| 169 | case 't': |
| 170 | follow = false; |
| 171 | break; |
| 172 | case 'b': |
Brian Silverman | f778031 | 2014-02-16 17:26:15 -0800 | [diff] [blame] | 173 | skip_to_end = false; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 174 | break; |
| 175 | case 'e': |
Brian Silverman | f778031 | 2014-02-16 17:26:15 -0800 | [diff] [blame] | 176 | skip_to_end = true; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 177 | break; |
| 178 | case 'm': |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 179 | if (!::aos::util::StringToInteger(::std::string(optarg), &display_max)) { |
| 180 | fprintf(stderr, "ERROR: -m expects a number, not '%s'.\n", optarg); |
| 181 | exit(EXIT_FAILURE); |
| 182 | } |
| 183 | if (display_max <= 0) { |
| 184 | fprintf(stderr, "LogDisplayer: invalid max log number '%s'\n", |
| 185 | optarg); |
| 186 | exit(EXIT_FAILURE); |
| 187 | } |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 188 | break; |
| 189 | case 'o': |
| 190 | abort(); |
| 191 | break; |
| 192 | case 'h': |
| 193 | PrintHelpAndExit(); |
| 194 | break; |
| 195 | case '?': |
| 196 | break; |
| 197 | default: |
Brian Silverman | ab6615c | 2013-03-05 20:29:29 -0800 | [diff] [blame] | 198 | fprintf(stderr, "LogDisplayer: in a bad spot (%s: %d)\n", |
| 199 | __FILE__, __LINE__); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 200 | abort(); |
| 201 | } |
| 202 | } |
| 203 | |
Daniel Petti | e6f33e2 | 2014-08-21 20:35:55 -0700 | [diff] [blame] | 204 | if (optind < argc) { |
| 205 | // We got a filename. |
| 206 | filename = argv[optind++]; |
| 207 | } |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 208 | if (optind < argc) { |
Daniel Petti | 88c81f4 | 2014-09-12 10:05:05 -0700 | [diff] [blame^] | 209 | fputs("non-option ARGV-elements: ", stderr); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 210 | while (optind < argc) { |
| 211 | fprintf(stderr, "%s\n", argv[optind++]); |
| 212 | } |
| 213 | } |
| 214 | |
Daniel Petti | e6f33e2 | 2014-08-21 20:35:55 -0700 | [diff] [blame] | 215 | fprintf(stderr, "displaying down to level %s from file '%s'\n", |
| 216 | ::aos::logging::log_str(filter_level), filename); |
| 217 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 218 | int fd = open(filename, O_RDONLY); |
Daniel Petti | e6f33e2 | 2014-08-21 20:35:55 -0700 | [diff] [blame] | 219 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 220 | if (fd == -1) { |
Brian Silverman | 01be000 | 2014-05-10 15:44:38 -0700 | [diff] [blame] | 221 | PLOG(FATAL, "couldn't open file '%s' for reading", filename); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 222 | } |
Brian Silverman | ab5ba47 | 2014-04-18 15:26:14 -0700 | [diff] [blame] | 223 | ::aos::logging::linux_code::LogFileReader reader(fd); |
Brian Silverman | f778031 | 2014-02-16 17:26:15 -0800 | [diff] [blame] | 224 | |
| 225 | if (skip_to_end) { |
| 226 | fputs("skipping old logs...\n", stderr); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 227 | } |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 228 | |
| 229 | const LogFileMessageHeader *msg; |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 230 | int displayed = 0; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 231 | do { |
Brian Silverman | ab5ba47 | 2014-04-18 15:26:14 -0700 | [diff] [blame] | 232 | msg = reader.ReadNextMessage(follow); |
Brian Silverman | 003ba4b | 2014-02-10 16:56:18 -0800 | [diff] [blame] | 233 | if (msg == NULL) { |
| 234 | fputs("reached end of file\n", stderr); |
| 235 | return 0; |
| 236 | } |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 237 | |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 238 | if (source_pid >= 0 && msg->source != source_pid) { |
| 239 | // Message is from the wrong process. |
| 240 | continue; |
| 241 | } |
| 242 | |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 243 | if (msg->type == LogFileMessageHeader::MessageType::kStructType) { |
| 244 | size_t bytes = msg->message_size; |
| 245 | ::aos::MessageType *type = ::aos::MessageType::Deserialize( |
| 246 | reinterpret_cast<const char *>(msg + 1), &bytes); |
| 247 | ::aos::type_cache::Add(*type); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 248 | continue; |
| 249 | } |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 250 | |
Brian Silverman | f778031 | 2014-02-16 17:26:15 -0800 | [diff] [blame] | 251 | if (skip_to_end) { |
Brian Silverman | ab5ba47 | 2014-04-18 15:26:14 -0700 | [diff] [blame] | 252 | if (reader.IsLastPage()) { |
Brian Silverman | f778031 | 2014-02-16 17:26:15 -0800 | [diff] [blame] | 253 | fputs("done skipping old logs\n", stderr); |
| 254 | skip_to_end = false; |
| 255 | } else { |
| 256 | continue; |
| 257 | } |
| 258 | } |
| 259 | |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 260 | if (::aos::logging::log_gt_important(filter_level, msg->level)) continue; |
| 261 | if (filter_name != NULL) { |
| 262 | if (filter_length != msg->name_size) continue; |
| 263 | if (memcmp(filter_name, |
| 264 | reinterpret_cast<const char *>(msg) + sizeof(*msg), |
| 265 | filter_length) != |
| 266 | 0) { |
| 267 | continue; |
| 268 | } |
| 269 | } |
| 270 | |
Daniel Petti | b6c885b | 2014-09-12 10:04:28 -0700 | [diff] [blame] | 271 | if (display_max && displayed++ >= display_max) { |
| 272 | fputs("Not displaying the rest of the messages.\n", stderr); |
| 273 | return 0; |
| 274 | } |
| 275 | |
Brian Silverman | a7234c6 | 2014-03-24 20:23:25 -0700 | [diff] [blame] | 276 | const char *position = |
| 277 | reinterpret_cast<const char *>(msg + 1) + msg->name_size; |
| 278 | #define BASE_ARGS \ |
| 279 | AOS_LOGGING_BASE_ARGS( \ |
| 280 | msg->name_size, reinterpret_cast<const char *>(msg + 1), msg->source, \ |
| 281 | msg->sequence, msg->level, msg->time_sec, msg->time_nsec) |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 282 | switch (msg->type) { |
Brian Silverman | a7234c6 | 2014-03-24 20:23:25 -0700 | [diff] [blame] | 283 | case LogFileMessageHeader::MessageType::kString: |
| 284 | fprintf(stdout, AOS_LOGGING_BASE_FORMAT "%.*s", BASE_ARGS, |
| 285 | static_cast<int>(msg->message_size), position); |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 286 | break; |
Brian Silverman | a7234c6 | 2014-03-24 20:23:25 -0700 | [diff] [blame] | 287 | case LogFileMessageHeader::MessageType::kStruct: { |
| 288 | uint32_t type_id; |
| 289 | memcpy(&type_id, position, sizeof(type_id)); |
| 290 | position += sizeof(type_id); |
Brian Silverman | 664db1a | 2014-03-20 17:06:29 -0700 | [diff] [blame] | 291 | |
Brian Silverman | a7234c6 | 2014-03-24 20:23:25 -0700 | [diff] [blame] | 292 | uint32_t string_length; |
| 293 | memcpy(&string_length, position, sizeof(string_length)); |
| 294 | position += sizeof(string_length); |
| 295 | |
| 296 | char buffer[2048]; |
| 297 | size_t output_length = sizeof(buffer); |
| 298 | size_t input_length = |
| 299 | msg->message_size - |
| 300 | (sizeof(type_id) + sizeof(uint32_t) + string_length); |
| 301 | if (!PrintMessage(buffer, &output_length, position + string_length, |
| 302 | &input_length, ::aos::type_cache::Get(type_id))) { |
| 303 | LOG(FATAL, "printing message (%.*s) of type %s into %zu-byte buffer " |
| 304 | "failed\n", |
| 305 | static_cast<int>(string_length), position, |
| 306 | ::aos::type_cache::Get(type_id).name.c_str(), sizeof(buffer)); |
| 307 | } |
| 308 | if (input_length > 0) { |
| 309 | LOG(WARNING, "%zu extra bytes on message of type %s\n", |
| 310 | input_length, ::aos::type_cache::Get(type_id).name.c_str()); |
| 311 | } |
| 312 | fprintf(stdout, AOS_LOGGING_BASE_FORMAT "%.*s: %.*s\n", BASE_ARGS, |
| 313 | static_cast<int>(string_length), position, |
| 314 | static_cast<int>(sizeof(buffer) - output_length), buffer); |
| 315 | } break; |
| 316 | case LogFileMessageHeader::MessageType::kMatrix: { |
| 317 | uint32_t type; |
| 318 | memcpy(&type, position, sizeof(type)); |
| 319 | position += sizeof(type); |
| 320 | |
| 321 | uint32_t string_length; |
| 322 | memcpy(&string_length, position, sizeof(string_length)); |
| 323 | position += sizeof(string_length); |
Brian Silverman | 664db1a | 2014-03-20 17:06:29 -0700 | [diff] [blame] | 324 | |
| 325 | uint16_t rows; |
| 326 | memcpy(&rows, position, sizeof(rows)); |
Brian Silverman | 664db1a | 2014-03-20 17:06:29 -0700 | [diff] [blame] | 327 | position += sizeof(rows); |
| 328 | uint16_t cols; |
| 329 | memcpy(&cols, position, sizeof(cols)); |
Brian Silverman | 664db1a | 2014-03-20 17:06:29 -0700 | [diff] [blame] | 330 | position += sizeof(cols); |
| 331 | |
Brian Silverman | a7234c6 | 2014-03-24 20:23:25 -0700 | [diff] [blame] | 332 | const size_t matrix_bytes = |
| 333 | msg->message_size - |
| 334 | (sizeof(type) + sizeof(uint32_t) + sizeof(uint16_t) + |
| 335 | sizeof(uint16_t) + string_length); |
| 336 | CHECK_EQ(matrix_bytes, ::aos::MessageType::Sizeof(type) * rows * cols); |
| 337 | char buffer[2048]; |
| 338 | size_t output_length = sizeof(buffer); |
| 339 | if (!::aos::PrintMatrix(buffer, &output_length, |
| 340 | position + string_length, type, rows, cols)) { |
| 341 | LOG(FATAL, "printing %dx%d matrix of type %" PRIu32 " failed\n", rows, |
| 342 | cols, type); |
| 343 | } |
| 344 | fprintf(stdout, AOS_LOGGING_BASE_FORMAT "%.*s: %.*s\n", BASE_ARGS, |
| 345 | static_cast<int>(string_length), position, |
| 346 | static_cast<int>(sizeof(buffer) - output_length), buffer); |
| 347 | } break; |
Brian Silverman | 88471dc | 2014-02-15 22:35:42 -0800 | [diff] [blame] | 348 | case LogFileMessageHeader::MessageType::kStructType: |
| 349 | LOG(FATAL, "shouldn't get here\n"); |
| 350 | break; |
Brian Silverman | a7234c6 | 2014-03-24 20:23:25 -0700 | [diff] [blame] | 351 | } |
| 352 | #undef BASE_ARGS |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 353 | } while (msg != NULL); |
| 354 | } |