Expand jit documentation a bit
[hiphop-php.git] / hphp / util / cronolog.h
blob9876facf7e96cf20bce71fb62ad55de536d41c42
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_CRONOLOG_H_
18 #define incl_HPHP_CRONOLOG_H_
20 #include <atomic>
21 #include <string>
22 #include <cstdio>
24 #include "hphp/util/cronoutils.h"
25 #include "hphp/util/lock.h"
26 #include "hphp/util/log-file-flusher.h"
28 namespace HPHP {
29 ///////////////////////////////////////////////////////////////////////////////
31 class Cronolog {
32 public:
33 Cronolog() :
34 m_periodicity(UNKNOWN),
35 m_periodDelayUnits(UNKNOWN),
36 m_periodMultiple(1),
37 m_periodDelay(0),
38 m_useAmericanDateFormats(0),
39 m_startTime(nullptr),
40 m_prevLinkName(nullptr),
41 m_timeOffset(0),
42 m_nextPeriod(0),
43 m_prevFile(nullptr),
44 m_file(nullptr) {}
45 ~Cronolog() {
46 if (m_prevFile) fclose(m_prevFile);
47 if (m_file) fclose(m_file);
49 void setPeriodicity();
50 FILE *getOutputFile();
51 static void changeOwner(const std::string &username,
52 const std::string &symlink);
53 public:
54 PERIODICITY m_periodicity;
55 PERIODICITY m_periodDelayUnits;
56 int m_periodMultiple;
57 int m_periodDelay;
58 int m_useAmericanDateFormats;
59 char m_fileName[PATH_MAX];
60 char *m_startTime;
61 std::string m_template;
62 std::string m_linkName;
63 char *m_prevLinkName;
64 time_t m_timeOffset;
65 time_t m_nextPeriod;
66 FILE *m_prevFile;
67 FILE *m_file;
68 LogFileFlusher flusher;
69 Mutex m_mutex;
71 private:
72 Cronolog(const Cronolog &); // suppress
73 Cronolog &operator=(const Cronolog &); // suppress
76 ///////////////////////////////////////////////////////////////////////////////
79 #endif // incl_HPHP_CRONOLOG_H_