/
LIB3/
LIB3/D/ADMIN/
LIB3/D/ADMIN/OBJ/
LIB3/D/ADMIN/ROOM/W/
LIB3/D/HOME/
LIB3/D/HOME/CITY/ARENA/
LIB3/D/HOME/CITY/ITEMS/
LIB3/D/HOME/CITY/POSTOFFI/
LIB3/DOC/
LIB3/GLOBAL/SPECIAL/
LIB3/GLOBAL/VIRTUAL/
LIB3/NET/
LIB3/NET/CONFIG/
LIB3/NET/DAEMON/CHARS/
LIB3/NET/GOPHER/
LIB3/NET/INHERIT/
LIB3/NET/OBJ/
LIB3/NET/SAVE/
LIB3/NET/VIRTUAL/
LIB3/OBJ/B_DAY/
LIB3/OBJ/HANDLERS/TERM_TYP/
LIB3/PLAYERS/B/
LIB3/PLAYERS/N/
LIB3/ROOM/
LIB3/SAVE/
LIB3/SAVE/BOARDS/
LIB3/SAVE/ENVIRON/
LIB3/SAVE/POST/
LIB3/STD/COMMANDS/SHADOWS/
LIB3/STD/CREATOR/
LIB3/STD/DOM/
LIB3/STD/EFFECTS/
LIB3/STD/EFFECTS/HEALING/
LIB3/STD/EFFECTS/OTHER/
LIB3/STD/EFFECTS/POISONS/
LIB3/STD/ENVIRON/
LIB3/STD/GUILDS/
LIB3/STD/LIQUIDS/
LIB3/STD/ROOM/
LIB3/STD/TRIGGER/SHADOW/
LIB3/W/
LIB3/W/BANNOR/
LIB3/W/NEWSTYLE/
#define DEBUGER "bannor"
#include "log.h"

void    smart_log( string type, string text, string file )
{
    int     i;
    string  temp1, temp2, junk, *j, *person;

    person = ({ });
    if( file[ 0 ] == '/' )
	file = file[ 1..10000 ];
    switch( file[ 0..1 ] )
    {
	case "w/":
	    sscanf( file, "w/%s/%s", temp1, temp2 );
	    if( file_size( "/w/" + temp1 ) == -2 )
	    {
		person += ({ temp1 });
	    }
	    else
		person += ({ DEBUGER });
	    break;
	case "d/":
	    sscanf( file, "d/%s/%s", temp1, temp2 );
	    person += ({ (string)("/d/" + temp1 + "/master")->log_who( file ) });
	    break;
    }
    if( file[ 0..4 ] == "room/" )
	person += ({ DEBUGER });
    if( file[ 0..6 ] == "global/" )
	person += ({ DEBUGER });
    if( file[ 0..3 ] == "std/" )
	person += ({ DEBUGER });
    if( file[ 0..3 ] == "net/" )
	person += ({ DEBUGER });
    if( file[ 0..3 ] == "obj/" )
	person += ({ DEBUGER });
    if( file[ 0..4 ] == "open/" )
	person += ({ DEBUGER });
    if( file[ 0..6 ] == "secure/" )
	person += ({ DEBUGER });
    if( file[ 0..3 ] == "tmp/" )
	person += ({ DEBUGER });

    temp2 = this_player()->query_name() + " " + time() + " " + file + "\n";
    log_file( "TEMPORARY_ERRORS", temp2 );
    j = explode( file, "/" );
    temp2 = (implode( j[ 0..sizeof( j ) - 2 ], "/" ) + "/" + ERROR_LOG);
    i = file_length( temp2 );
    if( i > 0 )
    {
	temp1 = read_file( temp2, i, 1 );
	if( sscanf( temp1, ".END %d", i ) == 1 )
	    i += 1;
	else
	    i = 1;
    }
    else
	i = 1;
    temp2 = implode( j[ 0..sizeof( j ) - 2 ], "/" ) + "/" + ERROR_LOG;
    if( sscanf( type, "%s %s", temp1, type ) == 2 )
    {
	text = temp1 + " " + type + "\n" + file + "\n" + "\n\n" + time() + "\n" + text;
	log_file( type, text );
	text = ".START " + i + "\n" + text + ".END " + i + "\n";
	write_file( temp2, text );
    }
    else
    {
	text = file + "\n" + "\n\n" + time() + "\n" + text;
	text = type + "\n" + text;
	log_file( type, text );
	text = ".START " + i + "\n" + text + ".END " + i + "\n";
	write_file( temp2, text );
    }
    for( i = 0; i < sizeof( person ); i++ )
    {
	temp1 = read_file( "/w/" + person[ i ] + "/" + PLAYER_ERROR_LOG );
	if( !temp1 )
	    temp1 = "";
	j = explode( temp1, "\n" );
	if( !j )
	    j = ({ });
	if( member_array( file, j ) == -1 )
	    j += ({ file });
	temp1 = implode( j, "\n" ) + "\n";
	"/secure/master"->do_log( person[ i ], temp1 );
    }
}