home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar Special 2004 August
/
GSSH0804.iso
/
Action
/
Parsec47
/
Parsec47.exe
/
p47
/
src
/
abagames
/
util
/
Logger.d
< prev
next >
Wrap
Text File
|
2003-11-29
|
2KB
|
80 lines
/*
* $Id: Logger.d,v 1.1.1.1 2003/11/28 17:26:30 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.Logger;
import std.stream;
/**
* Logger(error/info).
*/
version(Win32_release) {
import std.string;
import std.c.windows.windows;
public class Logger {
public static void info(char[] msg) {
// Win32 exe file crashes if it writes something to stderr.
//stderr.writeLine("Info: " ~ msg);
}
public static void info(int n) {
/*if (n >= 0)
stderr.writeLine("Info: " ~ std.string.toString(n));
else
stderr.writeLine("Info: -" ~ std.string.toString(-n));*/
}
private static void putMessage(char[] msg) {
MessageBoxA(null, std.string.toStringz(msg), "Error", MB_OK | MB_ICONEXCLAMATION);
}
public static void error(char[] msg) {
putMessage("Error: " ~ msg);
}
public static void error(Exception e) {
putMessage("Error: " ~ e.toString());
}
public static void error(Error e) {
putMessage("Error: " ~ e.toString());
}
}
} else {
public class Logger {
public static void info(char[] msg) {
stderr.writeLine("Info: " ~ msg);
}
public static void info(int n) {
if (n >= 0)
stderr.writeLine("Info: " ~ std.string.toString(n));
else
stderr.writeLine("Info: -" ~ std.string.toString(-n));
}
public static void error(char[] msg) {
stderr.writeLine("Error: " ~ msg);
}
public static void error(Exception e) {
stderr.writeLine("Error: " ~ e.toString());
}
public static void error(Error e) {
stderr.writeLine("Error: " ~ e.toString());
if (e.next)
error(e.next);
}
}
}