patch to make logs more readable and usable

patch to make logs more readable and usable

Nosūtīja Ne Nashev
Atbilžu skaits: 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.
Vidējais novērtējums: -
Atbildot uz Ne Nashev

Re: patch to make logs more readable and usable

Nosūtīja 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
Atbildot uz Ne Nashev

Re: patch to make logs more readable and usable

Nosūtīja Julian Ridden
Very nice addition. I have included a screencap for those who want to see exactly what this does.
Pielikums Picture_2.png
Atbildot uz Julian Ridden

Re: patch to make logs more readable and usable

Nosūtīja Faren Heit
Hi Julian,
Ive added this snippet of code to my lib.php but theres no change?
Am i missing something obvious?
Atbildot uz Julian Ridden

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

Nosūtīja 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

Atbildot uz Ne Nashev

Re: patch to make logs more readable and usable

Nosūtīja Martin Dougiamas
Core developers attēls Documentation writers attēls Moodle HQ attēls Particularly helpful Moodlers attēls Plugin developers attēls Testers attēls
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?  divējāds smaids
Atbildot uz Martin Dougiamas

in multi-person logs it look fine too

Nosūtīja 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 smaidīgs
Atbildot uz Ne Nashev

Re: in multi-person logs it look fine too

Nosūtīja Martin Dougiamas
Core developers attēls Documentation writers attēls Moodle HQ attēls Particularly helpful Moodlers attēls Plugin developers attēls Testers attēls
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.
Atbildot uz Martin Dougiamas

Re: in multi-person logs it look fine too

Nosūtīja 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:
Pielikums full_logs.jpg
Atbildot uz Ne Nashev

Re: patch to make logs more readable and usable

Nosūtīja 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





Atbildot uz Ne Nashev

Re: patch to make logs more readable and usable

Nosūtīja 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.
Atbildot uz N Hansen

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

Nosūtīja 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 piemiegta acs).

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?

Atbildot uz David Delgado

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

Nosūtīja 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!
Atbildot uz Ne Nashev

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

Nosūtīja Mark Little
Hi,

On what line do u add this coding?

Thanks
Atbildot uz Mark Little

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

Nosūtīja 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
Atbildot uz Ne Nashev

Re: patch to make logs more readable and usable

Nosūtīja 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
Atbildot uz Ne Nashev

Re: patch to make logs more readable and usable

Nosūtīja 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..