| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
| 6 module mojo.flog; | 6 module mojo.flog; |
| 7 | 7 |
| 8 // TODO(dalesat): Move out of media to somewhere more generic. | |
| 9 | |
| 10 // Exposed by the log service to enable creation and consumption of logs. | 8 // Exposed by the log service to enable creation and consumption of logs. |
| 11 [ServiceName="mojo::flog::FlogService"] | 9 [ServiceName="mojo::flog::FlogService"] |
| 12 interface FlogService { | 10 interface FlogService { |
| 13 // Creates a new logger. | 11 // Creates a new logger. |
| 14 CreateLogger(FlogLogger& logger, string label); | 12 CreateLogger(FlogLogger& logger, string label); |
| 15 | 13 |
| 16 // Gets the descriptions of all logs. | 14 // Gets the descriptions of all logs. |
| 17 GetLogDescriptions() => (array<FlogDescription> descriptions); | 15 GetLogDescriptions() => (array<FlogDescription> descriptions); |
| 18 | 16 |
| 19 // Gets a reader for the specified log. | 17 // Gets a reader for the specified log. |
| 20 CreateReader(FlogReader& reader, uint32 log_id); | 18 CreateReader(FlogReader& reader, uint32 log_id); |
| 21 }; | 19 }; |
| 22 | 20 |
| 23 // A logger that logs messages regarding multiple channels. | 21 // A logger that logs messages regarding multiple channels. |
| 24 interface FlogLogger { | 22 interface FlogLogger { |
| 25 // Logs the creation of a channel. | 23 // Logs the creation of a channel. |
| 26 LogChannelCreation(int64 time_us, uint32 channel_id, string type_name); | 24 LogChannelCreation(int64 time_us, uint32 channel_id, string type_name); |
| 27 | 25 |
| 28 // Logs a message sent to an existing channel. | 26 // Logs a message sent to an existing channel. |
| 29 LogChannelMessage(int64 time_us, uint32 channel_id, array<uint8> data); | 27 LogChannelMessage(int64 time_us, uint32 channel_id, array<uint8> data); |
| 30 | 28 |
| 31 // Logs the deletion of a channel. | 29 // Logs the deletion of a channel. |
| 32 LogChannelDeletion(int64 time_us, uint32 channel_id); | 30 LogChannelDeletion(int64 time_us, uint32 channel_id); |
| 31 |
| 32 // TODO(dalesat): Add a method for logging text/file/line |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // A reader that reads messages from one or more logs. | 35 // A reader that reads messages from one or more logs. |
| 36 interface FlogReader { | 36 interface FlogReader { |
| 37 // Gets entries from the log starting and the specified index (entries are | 37 // Gets entries from the log starting and the specified index (entries are |
| 38 // indexed starting at 0). If the log is open, the callback will be called | 38 // indexed starting at 0). If the log is open, the callback will be called |
| 39 // when max_count entries are avaiable starting at start_index. If the log | 39 // when max_count entries are avaiable starting at start_index. If the log |
| 40 // is closed, the callback will be called immediately with as many entries | 40 // is closed, the callback will be called immediately with as many entries |
| 41 // as are available starting at start_index and not exceeding max_count | 41 // as are available starting at start_index and not exceeding max_count |
| 42 // entries. entry_count and open refer to the entire log at the time the | 42 // entries. |
| 43 // callback occurred. | |
| 44 GetEntries(uint32 start_index, uint32 max_count) => | 43 GetEntries(uint32 start_index, uint32 max_count) => |
| 45 (array<FlogEntry> entries, uint32 entry_count, bool open); | 44 (array<FlogEntry> entries); |
| 46 }; | 45 }; |
| 47 | 46 |
| 47 // Describes a log. |
| 48 struct FlogDescription { | 48 struct FlogDescription { |
| 49 uint32 log_id; |
| 49 string label; | 50 string label; |
| 50 uint32 log_id; | |
| 51 uint32 entry_count; | |
| 52 int64 start_time_us; | |
| 53 int64 stop_time_us; | |
| 54 bool open; | 51 bool open; |
| 55 }; | 52 }; |
| 56 | 53 |
| 54 // Log entry produced by |FlogReader|. Entry type is determined by interrogating |
| 55 // the |details| field. |
| 57 struct FlogEntry { | 56 struct FlogEntry { |
| 58 int64 time_us; | 57 int64 time_us; |
| 59 uint32 log_id; | 58 uint32 log_id; |
| 60 uint32 channel_id; | 59 uint32 channel_id; |
| 61 FlogEntryDetails? details; | 60 FlogEntryDetails? details; |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 union FlogEntryDetails { | 63 union FlogEntryDetails { |
| 65 FlogChannelCreationEntryDetails channel_creation; | 64 FlogChannelCreationEntryDetails channel_creation; |
| 66 FlogChannelMessageEntryDetails channel_message; | 65 FlogChannelMessageEntryDetails channel_message; |
| 66 FlogChannelDeletionEntryDetails channel_deletion; |
| 67 // TODO(dalesat): Add details for text/file/line entry |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 struct FlogChannelCreationEntryDetails { | 70 struct FlogChannelCreationEntryDetails { |
| 70 string type_name; | 71 string type_name; |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 struct FlogChannelMessageEntryDetails { | 74 struct FlogChannelMessageEntryDetails { |
| 74 array<uint8> data; | 75 array<uint8> data; |
| 75 }; | 76 }; |
| 77 |
| 78 struct FlogChannelDeletionEntryDetails { |
| 79 }; |
| OLD | NEW |