-/* open the proper logfile */
-bool InspIRCd::OpenLog(char**, int)
-{
- /* This function only happens at startup now */
- if (Config->nofork)
- {
- this->Logs->SetupNoFork();
- }
- Config->MyDir = Config->GetFullProgDir();
-
- /* Attempt to find home directory, portable to windows */
- const char* home = getenv("HOME");
- if (!home)
- {
- /* No $HOME, log to %USERPROFILE% */
- home = getenv("USERPROFILE");
- if (!home)
- {
- /* Nothing could be found at all, log to current dir */
- Config->logpath = "./startup.log";
- }
- }
-
- if (!Config->writelog) return true; // Skip opening default log if -nolog
-
- if (!*this->LogFileName)
- {
- if (Config->logpath.empty())
- {
- Config->logpath = "./startup.log";
- }
-
- if (!Config->log_file)
- Config->log_file = fopen(Config->logpath.c_str(),"a+");
- }
- else
- {
- Config->log_file = fopen(this->LogFileName,"a+");
- }
-
- if (!Config->log_file)
- {
- return false;
- }
-
- FileWriter* fw = new FileWriter(Config->log_file);
- FileLogStream *f = new FileLogStream((Config->forcedebug ? DEBUG : DEFAULT), fw);
-
- this->Logs->AddLogType("*", f, true);
-
- return true;
-}
-