- if (!Config->writelog) return true; // Skip opening default log if -nolog
-
- if (!*this->LogFileName)
- {
- if (Config->logpath.empty())
- {
- std::string path = std::string(home) + "/.inspircd";
- if (!mkdir(path.c_str(), 0700) && errno != EEXIST)
- {
- /* Log to ~/.inspircd/ircd.log */
- Config->logpath = path + "/startup.log";
- }
- else
- {
- /* Couldn't make ~/.inspircd directory, log to current dir */
- Config->logpath = "./startup.log";
- printf("\nWARNING: Unable to create directory: %s (%s)\n", path.c_str(), strerror(errno));
- }
- }
-
- Config->log_file = fopen(Config->logpath.c_str(),"a+");
- }
- else
- {
- Config->log_file = fopen(this->LogFileName,"a+");
- }
-
- if (!Config->log_file)