cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimir-kotikov <...@git.apache.org>
Subject [GitHub] cordova-windows pull request: CB-8936 Introduced --dump arg in log...
Date Fri, 04 Sep 2015 07:17:38 GMT
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/119#discussion_r38726887
  
    --- Diff: template/cordova/lib/log.js ---
    @@ -30,33 +30,87 @@ var platformRoot = path.join(__dirname, '..', '..'),
         configPath   = path.join(projectRoot, 'config.xml');
     
     // variables
    -var appTracingInitialState = null,
    +var appTracingLog          = 'Microsoft-Windows-AppHost/ApplicationTracing',
    +    appTracingInitialState = null,
         appTracingCurrentState = null,
    -    adminInitialState = null,
    -    adminCurrentState = null,
    +    adminLog               = 'Microsoft-Windows-AppHost/Admin',
    +    adminInitialState      = null,
    +    adminCurrentState      = null,
    +    timers                 = [],
         appName;
     
     /*
      * Gets windows AppHost/ApplicationTracing and AppHost/Admin logs
      * and prints them to console
      */
    -module.exports.run = function() {
    -    getLogState('Microsoft-Windows-AppHost/Admin').then(function (state) {
    +module.exports.run = function(args) {
    +    var dump = false, 
    +        startTime = new Date(new Date().getTime() - 10 * 60 * 1000).toISOString(); //
show last 10 minutes by default
    +
    +    if (args.length > 0) {
    +        for (var i = 0; i < args.length; i++) {
    +            switch (args[i]) {
    +                case '--startTime':
    +                case '-t':
    +                    if (i < args.length - 1) {
    +                        startTime = args[++i];
    +                    }
    +                    break;
    +                case '--dump':
    +                case '-d':
    +                    dump = true;
    +                    break;
    +                case '--help':
    +                case '-h':
    +                    module.exports.help();
    +                    return;
    +                default:
    +                    console.warn('Ignoring unknown arg: ' + args[i]);
    +            }
    +        }
    +    }
    +
    +    if (dump) {
    +        console.log('Dumping logs starting from ' + startTime);
    +        var appTracingEvents, adminEvents;
    +        getEvents(appTracingLog, startTime).then(function (evts) {
    +            appTracingEvents = evts;
    +            return getEvents(adminLog, startTime);
    +        }).then(function(evts) {
    +            adminEvents = evts;
    +            appTracingEvents.concat(adminEvents)
    +            .sort(function(evt1, evt2) {
    +                if (evt1.timeCreated < evt2.timeCreated) {
    +                    return -1;
    --- End diff --
    
    Oh, i see...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message