1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Use chrome.logPrivate API to retrieve log information from multiple 6 // resources in a consistent format. 7 namespace logPrivate { 8 9 // A filter class that filters log entries by different fields 10 dictionary Filter { 11 // Only logs from |sources| will be returned. 12 DOMString[] sources; 13 // Only logs created in [|start_timestamp|, |end_timestamp|] will 14 // be returned. 15 double start_timestamp; 16 double end_timestamp; 17 // Only logs have process name in |process| will be returned. 18 DOMString[] process; 19 // Only logs have level in |level| will be returned. 20 DOMString[] level; 21 // Private information will be scrubbed if |scrub| is true. 22 boolean scrub; 23 }; 24 25 // The class that contains log information. 26 dictionary LogEntry { 27 // The time of the log in milliseconds. 28 double timestamp; 29 // The raw text of log. 30 DOMString full_entry; 31 // The name of the process that the log associated with. 32 DOMString process; 33 // The ID of the process that the log associated with. 34 DOMString process_id; 35 // The log level. 36 DOMString level; 37 }; 38 39 // The class that is returned to callback function. 40 dictionary Result { 41 // The filter specified to filter log result. 42 Filter filter; 43 // Log entries returned based on the filter. 44 LogEntry[] data; 45 }; 46 47 callback GetHistoricalCallback = void (Result res); 48 49 callback DumpLogsCallback = void ([instanceOf=FileEntry] object logs); 50 51 callback CompletionCallback = void (); 52 53 // The type of the events to be recorded. 54 enum EventType { network }; 55 56 // The type of the event sink where captured events will be sent. 57 enum EventSink { 58 // Events will be sent to the webapp via onCapturedEvents. 59 capture, 60 // Events will be sent to a log file which can be collected 61 // through archive generated with dumpLogs() call. 62 file 63 }; 64 65 interface Functions { 66 // Get the existing logs from ChromeOS system. 67 static void getHistorical(Filter filter, GetHistoricalCallback callback); 68 // Start capturing events of specific type. 69 static void startEventRecorder(EventType eventType, 70 EventSink sink, 71 CompletionCallback callback); 72 // Stop capturing events of specific type. 73 static void stopEventRecorder(EventType eventType, CompletionCallback callback); 74 // Dump all system and captured events into a .tar.gz file. 75 // The archive file will contain following top level directories: 76 // /var/log/ 77 // ChromeOS system logs. 78 // /home/chronos/user/log/ 79 // Session specific logs (chrome app logs). 80 // /home/chronos/user/log/apps/<app_id> 81 // Contains webapp specific logs including those collected with 82 // startEventRecorder(..., sink="file") call. 83 static void dumpLogs(DumpLogsCallback callback); 84 }; 85 86 interface Events { 87 // Receives events of type which is currently being captured. 88 static void onCapturedEvents(object[] entries); 89 }; 90 }; 91