ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/dclient/include/adt/logs.h
Revision: 1.1
Committed: Mon Oct 18 14:11:43 2010 UTC (13 years, 9 months ago) by sf-pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
check and log but do not die when ncurses stuff fails

File Contents

# Content
1 #pragma once
2
3 #include <fstream>
4
5 struct logstream
6 {
7 logstream (char const *file, int line, char const *func);
8 ~logstream ();
9
10 logstream const &operator () (char const *channel = "dclient") const;
11
12 static std::ofstream fh;
13
14 char const *file;
15 long line;
16 char const *func;
17 };
18
19 template<typename T>
20 static inline logstream const &
21 operator << (logstream const &log, T const &v)
22 {
23 log.fh << v;
24 return log;
25 }
26
27 #define LOG logstream (__FILE__, __LINE__, __func__)