#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 ); } }