Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 20, 2009, 5:32:04 PM (16 years ago)
Author:
rgrieder
Message:

Fixed install target:

  • log and config file go a to separate folder each
  • The SignalHandler crash log is now "orxonox_crash.log" to avoid opening the file twice which might result in problems
  • moved tcl scripts to media/tcl8.#/ as a temporary solution. I've also created a ticket to fix this.
  • UPDATE YOUR MEDIA REPOSITORY
  • orxonox.log pre-main gets written to either %TEMP% (windows) or /tmp (Unix) and when the path was set, the content is copied.
  • removed Settings class and moved media path to Core
  • media, log and config path are now all in Core where only the media path can be configured via ini file or command line
  • Core::isDevBuild() tells whether we are running in the build or the installation directory (determined by the presence of "orxonox_dev_build.kepp_me" in the binary dir)
  • renamed Settings::getDataPath to Core::getMediaPath
Location:
code/branches/buildsystem3/src/util
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem3/src/util/OutputBuffer.cc

    r2171 r2685  
    6868    OutputBuffer& OutputBuffer::operator<<(std::ostream& (*manipulator)(std::ostream&))
    6969    {
    70                 this->stream_ << manipulator;
    71                 this->callListeners();
    72                 return *this;
     70        this->stream_ << manipulator;
     71        this->callListeners();
     72        return *this;
    7373    }
    7474
     
    7979    OutputBuffer& OutputBuffer::operator<<(std::ios& (*manipulator)(std::ios&))
    8080    {
    81                 this->stream_ << manipulator;
    82                 this->callListeners();
    83                 return *this;
     81        this->stream_ << manipulator;
     82        this->callListeners();
     83        return *this;
    8484    }
    8585
     
    9090    OutputBuffer& OutputBuffer::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
    9191    {
    92                 this->stream_ << manipulator;
    93                 this->callListeners();
    94                 return *this;
     92        this->stream_ << manipulator;
     93        this->callListeners();
     94        return *this;
    9595    }
    9696
  • code/branches/buildsystem3/src/util/OutputHandler.cc

    r2662 r2685  
    3333
    3434#include "OutputHandler.h"
    35 #include <time.h>
     35
     36#include <ctime>
     37#include <cstdlib>
    3638
    3739namespace orxonox
     
    4143        @param logfilename The name of the logfile
    4244    */
    43     OutputHandler::OutputHandler(const std::string& logfilename)
    44     {
     45    OutputHandler::OutputHandler()
     46    {
     47#ifdef ORXONOX_PLATFORM_WINDOWS
     48        char* pTempDir = getenv("TEMP");
     49        this->logfilename_ = std::string(pTempDir) + "/orxonox.log";
     50#else
     51        this->logfilename_ = "/tmp/orxonox.log";
     52#endif
     53#ifdef NDEBUG
     54        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 2;
     55        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 1;
     56#else
     57        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 3;
     58        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 2;
     59#endif
     60
    4561        this->outputBuffer_ = &this->fallbackBuffer_;
    46         this->softDebugLevel_[0] = this->softDebugLevel_[1] = this->softDebugLevel_[2] = this->softDebugLevel_[3] = 2;
    47         this->logfilename_ = logfilename;
    4862        this->logfile_.open(this->logfilename_.c_str(), std::fstream::out);
    4963
     
    5367        timeinfo = localtime(&rawtime);
    5468
    55         this->logfile_ << "Started log at " << asctime(timeinfo) << std::endl;
     69        this->logfile_ << "Started log on " << asctime(timeinfo) << std::endl;
    5670        this->logfile_.flush();
    5771    }
     
    7286    OutputHandler& OutputHandler::getOutStream()
    7387    {
    74         static OutputHandler orxout("orxonox.log");
     88        static OutputHandler orxout;
    7589        return orxout;
    7690    }
     
    112126
    113127    /**
     128        @brief Sets the path where to create orxonox.log
     129        @param Path string with trailing slash
     130    */
     131    void OutputHandler::setLogPath(const std::string& path)
     132    {
     133        OutputHandler::getOutStream().logfile_.close();
     134        // store old content
     135        std::ifstream old;
     136        old.open(OutputHandler::getOutStream().logfilename_.c_str());
     137        OutputHandler::getOutStream().logfilename_ = path + "orxonox.log";
     138        OutputHandler::getOutStream().logfile_.open(OutputHandler::getOutStream().logfilename_.c_str(), std::fstream::out);
     139        OutputHandler::getOutStream().logfile_ << old.rdbuf();
     140        old.close();
     141        OutputHandler::getOutStream().logfile_.flush();
     142    }
     143
     144    /**
    114145        @brief Overloaded << operator, redirects the output to the console and the logfile.
    115146        @param sb The streambuffer that should be shown in the console
  • code/branches/buildsystem3/src/util/OutputHandler.h

    r2662 r2685  
    101101            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
    102102
     103            static void setLogPath(const std::string& path);
     104
    103105            void setOutputBuffer(OutputBuffer* buffer);
    104106
     
    142144
    143145        private:
    144             explicit OutputHandler(const std::string& logfilename);
    145             OutputHandler(const OutputHandler& oh);  // don't copy
     146            explicit OutputHandler();
     147            OutputHandler(const OutputHandler& oh);
    146148            virtual ~OutputHandler();
    147149
  • code/branches/buildsystem3/src/util/SignalHandler.cc

    r2664 r2685  
    159159      }
    160160
    161       COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox.log" << std::endl;
     161      COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox_crash.log" << std::endl;
    162162
    163163      int sigPipe[2];
Note: See TracChangeset for help on using the changeset viewer.