patch to make logs more readable and usable

patch to make logs more readable and usable

autor Ne Nashev -
Počet odpovědí: 20
In logs table (/course/user.php?mode=alllogs...) too hard to see when user was started working, when hi was done, how long hi was working and how long they was away.

I have idea: if interval between two log records more then one hour, we can write session separator! It can be with some information about displayed working session and about founded interval.

And this idea in result here as simple patch (in base of v1.5.3+), which i would like to be injected into main moodle branch. General developers, please, look at this and add into CSV!


to file /course/lib.php add two piece of code

1) Inside loop by log records add
        $log->url  = str_replace('&', '&', $log->url); /// XHTML compatibility

// <<-- start of addition 1
if (isset($PrevTime) and (($PrevTime - $log->time) > 1*60*60)) {
echo '<tr class="r'.$row.'"><td colspan=6>';
echo get_string('log_work_time').': ';
$diff = (floor($BeginTime / 60) - floor($PrevTime / 60)) * 60;
echo $diff==0?'0':format_time($diff);
unset($BeginTime);
echo '<hr>'.get_string('log_interval').': ';
echo format_time((floor($PrevTime / 60) - floor($log->time / 60)) * 60);
echo '<br><hr></td></tr>';
}
$PrevTime = $log->time;
if (!isset($BeginTime)) {
$BeginTime = $log->time;
}
// -->> finish of addition 1
2) just after cicle:
    }
// <<-- start of addition 2
if (isset($PrevTime) and isset($BeginTime)) {
echo '<tr class="r'.$row.'"><td colspan=6>';
echo get_string('log_work_time').': ';
$diff = (floor($BeginTime / 60) - floor($PrevTime / 60)) * 60;
echo $diff==0?'0':format_time($diff);
echo '</td></tr>';
}
// -->> finish of addition 2
echo '</table>';
And (optional Улыбка) into lang/en/moodle.php add two strings - 'log_work_time' and 'log_interval' with some interpretation.
Průměr hodnocení: -
V odpovědi na Ne Nashev

Re: patch to make logs more readable and usable

autor Jeremy B -
Hello,

This is an excellent patch.  I've tested it on my systems and it works perfectly.  My clients find this additional information in the logs very useful.

Thanks again for putting your time into this.

JB
V odpovědi na Ne Nashev

Re: patch to make logs more readable and usable

autor Julian Ridden -
Very nice addition. I have included a screencap for those who want to see exactly what this does.
Příloha Picture_2.png
V odpovědi na Julian Ridden

Re: patch to make logs more readable and usable

autor Faren Heit -
Hi Julian,
Ive added this snippet of code to my lib.php but theres no change?
Am i missing something obvious?
V odpovědi na Julian Ridden

Urgent !!! Re: patch to make logs more readable and usable

autor Hajjej Mohamed Ala Eddine -

Hello,
I try to add these codes in the page / course / lib.php but the patch does not work is that you can tell me exactly where to add the code
Please find the original file lib.php  and the file  lib.php after modification is that I have insert the code
Thank you in advance

V odpovědi na Ne Nashev

Re: patch to make logs more readable and usable

autor Martin Dougiamas -
Obrázek: Core developers Obrázek: Documentation writers Obrázek: Moodle HQ Obrázek: Particularly helpful Moodlers Obrázek: Plugin developers Obrázek: Testers
Good idea, though shouldn't this only be applied to one-person logs?

If you had 20 people using Moodle at the same time does it make sense to call it a session?  smíšený pocit
V odpovědi na Martin Dougiamas

in multi-person logs it look fine too

autor Ne Nashev -
i'd try to find multi-user logs to see this there - and found
/course/log.php?id=1&chooselog=1&user=0&date=0&modid=&modaction=&group=-1&perpage=100&page=3

As result can say: in my site it looks as nice moodle-wide activity sessions information úsměv
V odpovědi na Ne Nashev

Re: in multi-person logs it look fine too

autor Martin Dougiamas -
Obrázek: Core developers Obrázek: Documentation writers Obrázek: Moodle HQ Obrázek: Particularly helpful Moodlers Obrázek: Plugin developers Obrázek: Testers
Can you show a screenshot?  One with many people accessing Moodle at the same time.  I don't think sessions makes sense in that case.
V odpovědi na Martin Dougiamas

Re: in multi-person logs it look fine too

autor Ne Nashev -
In sites with single time zone users it will be day from day separations - in logs it useful.

In multi time zone sites it will be only display holes in user activity - it useful for site admin to make in this times some site-wide manipulations.

Main here - to position this feature as is - as displaying log holes more then one hour, but not as "user work sessions".

I am in my russian interface translate work time as "Итого" (it is like footer "Summ" in last line of financial tables) and interval as "Перерыв в работе:" (it like "Break in works") - sorry my English

P.S.: in my site now much less then 20 active users, but here screenshot for you:
Příloha full_logs.jpg
V odpovědi na Ne Nashev

Re: patch to make logs more readable and usable

autor Bernard Boucher -
Hi Ne,
very good addition.

I use a small "stats line" before details:

.

For 1 user ( Admin ) at that semester, 1146 differents activities, 12485 events, 357 hours total, 290 hours in school ( Cegep ) , 66 hours outside.

Another example for 1 user all activities for one 45 hours course:

.

1 activity and 1 group it give at least then number of users that did the activity:

.

It is sure that the totals for many users are less meaningfull that the totals of one user.

Maybe it should be good to integrate the two hacks?

I hope it may help,

Bernard





V odpovědi na Ne Nashev

Re: patch to make logs more readable and usable

autor N Hansen -
I'd like something that would allow me to track users by their IP. Sometimes people start off as guests but then register at some point later, but that can only be tracked through the IP. Some people may regularly visit the site as a guest unless they want to post something, and again, that could be tracked by IP. It won't work for all users, especially ones on AOL, but it would in some cases be a better alternative for tracking behavior.
V odpovědi na N Hansen

Re: patch to make logs more readable and usable - IP tracking

autor David Delgado -

And... what about dynamic IP systems? I think they are most common nowadays. Each time you connect, you are assigned a different IP (not in my case mrknout).

You can also go directly to the Apache logs and track IP's by copying the log file and filtering it with grep utility (show only that IP hits). Anyway, it is quite an advanced feature to implement in Moodle web interface, isn't it?

V odpovědi na David Delgado

Re: patch to make logs more readable and usable - IP tracking

autor Ne Nashev -
it may be interesting, if with "no user" and "Guest user" become displaying (in grey or by popup hint) list of users, which anywhen was logged from same IP!
V odpovědi na Ne Nashev

Re: patch to make logs more readable and usable - IP tracking

autor Mark Little -
Hi,

On what line do u add this coding?

Thanks
V odpovědi na Mark Little

Re: patch to make logs more readable and usable - IP tracking

autor Ne Nashev -
this - it is You about path to make more readable? in this case first block just after after line " $log->url = str_replace('&', '&', $log->url); /// XHTML compatibility" and second - before line with printing </table> that just after loop.

if you about IP tracking - i hav'nt code for that feature, but i think it is simple to make it and locate place for them
V odpovědi na Ne Nashev

Re: patch to make logs more readable and usable

autor Tatiana Reis -
Good morning to all of Brazil and I am not a PHP programmer, despite having seen several prints of paintings and wonderful reports could not do this, personal staff a little patience but we are many lay people, need the things explained well, I put the code in several places but does not work, I do not declare variables at the end and asking how they are optional, my version is 1.9. Please help me.

Thanks
V odpovědi na Ne Nashev

Re: patch to make logs more readable and usable

autor Rahim Ahmad -

for moodle 1.9.10 version is the same code for time tracker..why i use this code in moodle 1.9.10 cannot run..please help me..