lt sync 1732

This commit is contained in:
Marcos Pinto 2007-11-17 11:45:19 +00:00
parent 4ff0a04608
commit 732c3d8674
5 changed files with 47 additions and 11 deletions

View File

@ -184,7 +184,11 @@ namespace libtorrent
session_impl(
std::pair<int, int> listen_port_range
, fingerprint const& cl_fprint
, char const* listen_interface = "0.0.0.0");
, char const* listen_interface
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
, fs::path const& logpath
#endif
);
~session_impl();
#ifndef TORRENT_DISABLE_EXTENSIONS
@ -575,6 +579,7 @@ namespace libtorrent
// whe shutting down process
std::list<boost::shared_ptr<tracker_logger> > m_tracker_loggers;
fs::path m_logpath;
public:
boost::shared_ptr<logger> m_logger;
private:

View File

@ -58,11 +58,11 @@ namespace libtorrent
struct logger
{
logger(fs::path const& filename, int instance, bool append = true)
logger(fs::path const& logpath, fs::path const& filename, int instance, bool append = true)
{
try
{
fs::path dir(fs::complete("libtorrent_logs" + boost::lexical_cast<std::string>(instance)));
fs::path dir(fs::complete(logpath / ("libtorrent_logs" + boost::lexical_cast<std::string>(instance))));
if (!fs::exists(dir)) fs::create_directories(dir);
m_file.open((dir / filename).string().c_str(), std::ios_base::out | (append ? std::ios_base::app : std::ios_base::out));
*this << "\n\n\n*** starting log ***\n";

View File

@ -121,11 +121,19 @@ namespace libtorrent
public:
session(fingerprint const& print = fingerprint("LT"
, LIBTORRENT_VERSION_MAJOR, LIBTORRENT_VERSION_MINOR, 0, 0));
, LIBTORRENT_VERSION_MAJOR, LIBTORRENT_VERSION_MINOR, 0, 0)
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
, fs::path logpath = "."
#endif
);
session(
fingerprint const& print
, std::pair<int, int> listen_port_range
, char const* listen_interface = "0.0.0.0");
, char const* listen_interface = "0.0.0.0"
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
, fs::path logpath = "."
#endif
);
~session();

View File

@ -106,8 +106,16 @@ namespace libtorrent
session::session(
fingerprint const& id
, std::pair<int, int> listen_port_range
, char const* listen_interface)
: m_impl(new session_impl(listen_port_range, id, listen_interface))
, char const* listen_interface
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
, fs::path logpath
#endif
)
: m_impl(new session_impl(listen_port_range, id, listen_interface
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
, logpath
#endif
))
{
// turn off the filename checking in boost.filesystem
TORRENT_ASSERT(listen_port_range.first > 0);
@ -121,8 +129,16 @@ namespace libtorrent
#endif
}
session::session(fingerprint const& id)
: m_impl(new session_impl(std::make_pair(0, 0), id))
session::session(fingerprint const& id
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
, fs::path logpath
#endif
)
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
: m_impl(new session_impl(std::make_pair(0, 0), id, "0.0.0.0", logpath))
#else
: m_impl(new session_impl(std::make_pair(0, 0), id, "0.0.0.0"))
#endif
{
#ifndef NDEBUG
boost::function0<void> test = boost::ref(*m_impl);

View File

@ -545,7 +545,11 @@ namespace detail
session_impl::session_impl(
std::pair<int, int> listen_port_range
, fingerprint const& cl_fprint
, char const* listen_interface)
, char const* listen_interface
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
, fs::path const& logpath
#endif
)
: m_send_buffers(send_buffer_size)
, m_files(40)
, m_strand(m_io_service)
@ -570,6 +574,9 @@ namespace detail
#endif
, m_timer(m_io_service)
, m_next_connect_torrent(0)
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
, m_logpath(logpath)
#endif
, m_checker_impl(*this)
{
#ifdef WIN32
@ -1602,7 +1609,7 @@ namespace detail
, int instance, bool append)
{
// current options are file_logger, cout_logger and null_logger
return boost::shared_ptr<logger>(new logger(name + ".log", instance, append));
return boost::shared_ptr<logger>(new logger(m_logpath, name + ".log", instance, append));
}
#endif