remove full path from error messages

This commit is contained in:
Daniel Larimer 2012-12-12 13:41:33 -05:00
parent 7ca7aede5f
commit a02edaebd3
2 changed files with 6 additions and 3 deletions

View file

@ -1,9 +1,9 @@
#include <fc/error_report.hpp> #include <fc/error_report.hpp>
#include <fc/filesystem.hpp>
namespace fc { namespace fc {
error_frame::error_frame( const fc::string& f, uint64_t l, const fc::string& m, const fc::string& d, fc::value met ) error_frame::error_frame( const fc::string& f, uint64_t l, const fc::string& m, const fc::string& d, fc::value met )
:desc(d),file(f),line(l),method(m),meta(fc::move(met)){} :desc(d),file(fc::path(f).filename().generic_string()),line(l),method(m),meta(fc::move(met)){}
error_report::error_report() error_report::error_report()
{ {

View file

@ -8,12 +8,14 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <fc/filesystem.hpp>
#include <iostream> #include <iostream>
namespace fc { namespace fc {
const char* thread_name(); const char* thread_name();
void* thread_ptr(); void* thread_ptr();
/*
const char* short_name( const char* file_name ) { const char* short_name( const char* file_name ) {
const char* end = file_name + strlen(file_name); const char* end = file_name + strlen(file_name);
--end; --end;
@ -25,6 +27,7 @@ namespace fc {
} }
return file_name; return file_name;
} }
*/
#ifdef WIN32 #ifdef WIN32
#define isatty _isatty #define isatty _isatty
@ -39,7 +42,7 @@ namespace fc {
std::cerr<<"\r"<<color; std::cerr<<"\r"<<color;
#endif #endif
fprintf( stderr, "%-15s %-15s %-5zd %-15s ", thread_name(), short_name(file_name), line_num, method_name ); fprintf( stderr, "%-15s %-15s %-5zd %-15s ", thread_name(), fc::path(file_name).filename().generic_string().c_str(), line_num, method_name );
//std::cerr<<thread_ptr()<< thread_name()<< short_name(file_name)<< line_num<< method_name ; //std::cerr<<thread_ptr()<< thread_name()<< short_name(file_name)<< line_num<< method_name ;
va_list args; va_list args;
va_start(args,format); va_start(args,format);