mirror of https://github.com/buggins/dlangui.git
Merge pull request #380 from John-Colvin/patch-3
fix taking address of std{out,err} for dmd 2.075.0-b1
This commit is contained in:
commit
10bb4b4537
11
.travis.yml
11
.travis.yml
|
|
@ -4,6 +4,13 @@ os:
|
||||||
- linux
|
- linux
|
||||||
- osx
|
- osx
|
||||||
|
|
||||||
|
d:
|
||||||
|
- dmd
|
||||||
|
- dmd-beta
|
||||||
|
- ldc
|
||||||
|
- ldc-beta
|
||||||
|
- gdc-6.3.0
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- ARCH=x86_64 CONFIG=default
|
- ARCH=x86_64 CONFIG=default
|
||||||
- ARCH=x86_64 CONFIG=minimal
|
- ARCH=x86_64 CONFIG=minimal
|
||||||
|
|
@ -11,7 +18,7 @@ env:
|
||||||
- ARCH=x86 CONFIG=default
|
- ARCH=x86 CONFIG=default
|
||||||
- ARCH=x86 CONFIG=minimal
|
- ARCH=x86 CONFIG=minimal
|
||||||
- ARCH=x86 CONFIG=x11
|
- ARCH=x86 CONFIG=x11
|
||||||
|
|
||||||
# No-one cares about OS X x86 and X11 on OSX
|
# No-one cares about OS X x86 and X11 on OSX
|
||||||
matrix:
|
matrix:
|
||||||
exclude:
|
exclude:
|
||||||
|
|
@ -23,6 +30,8 @@ matrix:
|
||||||
env: ARCH=x86 CONFIG=x11
|
env: ARCH=x86 CONFIG=x11
|
||||||
- os: osx
|
- os: osx
|
||||||
env: ARCH=x86_64 CONFIG=x11
|
env: ARCH=x86_64 CONFIG=x11
|
||||||
|
- os: osx
|
||||||
|
d: gdc-6.3.0
|
||||||
|
|
||||||
sudo: true
|
sudo: true
|
||||||
before_script:
|
before_script:
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,8 @@ enum LogLevel : int {
|
||||||
return std.datetime.Clock.currStdTime / 10000;
|
return std.datetime.Clock.currStdTime / 10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Logging utilities
|
Logging utilities
|
||||||
|
|
||||||
Setup example:
|
Setup example:
|
||||||
|
|
@ -92,6 +92,14 @@ Log.e("exception while reading file", e);
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
private auto std_io_err_helper(alias v)()
|
||||||
|
{
|
||||||
|
static if (__VERSION__ < 2075)
|
||||||
|
return &v;
|
||||||
|
else
|
||||||
|
return &v();
|
||||||
|
}
|
||||||
|
|
||||||
class Log {
|
class Log {
|
||||||
static __gshared private LogLevel logLevel = LogLevel.Info;
|
static __gshared private LogLevel logLevel = LogLevel.Info;
|
||||||
static __gshared private std.stdio.File * logFile = null;
|
static __gshared private std.stdio.File * logFile = null;
|
||||||
|
|
@ -102,25 +110,25 @@ class Log {
|
||||||
_mutex = new Mutex();
|
_mutex = new Mutex();
|
||||||
return _mutex;
|
return _mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Redirects output to stdout
|
/// Redirects output to stdout
|
||||||
static public void setStdoutLogger() {
|
static public void setStdoutLogger() {
|
||||||
synchronized(mutex) {
|
synchronized(mutex) {
|
||||||
logFile = &stdout;
|
logFile = std_io_err_helper!stdout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Redirects output to stderr
|
/// Redirects output to stderr
|
||||||
static public void setStderrLogger() {
|
static public void setStderrLogger() {
|
||||||
synchronized(mutex) {
|
synchronized(mutex) {
|
||||||
logFile = &stderr;
|
logFile = std_io_err_helper!stderr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Redirects output to file
|
/// Redirects output to file
|
||||||
static public void setFileLogger(File * file) {
|
static public void setFileLogger(File * file) {
|
||||||
synchronized(mutex) {
|
synchronized(mutex) {
|
||||||
if (logFile !is null && logFile != &stdout && logFile != &stderr) {
|
if (logFile !is null && *logFile != stdout && *logFile != stderr) {
|
||||||
logFile.close();
|
logFile.close();
|
||||||
destroy(logFile);
|
destroy(logFile);
|
||||||
logFile = null;
|
logFile = null;
|
||||||
|
|
@ -323,7 +331,7 @@ class Log {
|
||||||
logf(LogLevel.Fatal, args);
|
logf(LogLevel.Fatal, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
version (Android) {
|
version (Android) {
|
||||||
static public void setLogTag(const char * tag) {
|
static public void setLogTag(const char * tag) {
|
||||||
ANDROID_LOG_TAG = tag;
|
ANDROID_LOG_TAG = tag;
|
||||||
|
|
@ -348,4 +356,3 @@ void onResourceDestroyWhileShutdown(string resourceName, string objname = null)
|
||||||
|
|
||||||
/// set to true when exiting main - to detect destructor calls for resources by GC
|
/// set to true when exiting main - to detect destructor calls for resources by GC
|
||||||
__gshared bool APP_IS_SHUTTING_DOWN = false;
|
__gshared bool APP_IS_SHUTTING_DOWN = false;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue