fCraft  0.638
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
fCraft.Logger Class Reference

Central logging class. Logs to file, relays messages to the frontend, submits crash reports. More...

Static Public Member Functions

static void LogToConsole ([NotNull] string message)
 Logs a message of type ConsoleOutput, strips colors, and splits into multiple messages at newlines. Use this method for all messages of LogType.ConsoleOutput
 
static void Log (LogType type,[NotNull] string message,[NotNull] params object[] args)
 Adds a message to the server log. Depending on server configuration and log category, message can be shown in console, logged to file, both, or neither.
 
static void DisableFileLogging ()
 Disables all file logging (sets all LogFileOptions to false).
 
static void LogAndReportCrash ([CanBeNull] string message,[CanBeNull] string assembly,[CanBeNull] Exception exception, bool shutdownImminent)
 Logs and reports a crash or an unhandled exception. Details are logged, and a crash report may be submitted to fCraft.net. Note that this method may take several seconds to finish, since it gathers system information and possibly communicates to fCraft.net.
 

Static Public Attributes

static readonly bool[] ConsoleOptions
 
static readonly bool[] LogFileOptions
 

Properties

static bool Enabled [get, set]
 Gets or sets whether logging is globally enabled/disabled. If "–nolog" command-line argument is given, logging is disabled.
 
static string CurrentLogFileName [get]
 Name of the file that log messages are currently being written to. Does not include path to the log folder (see Paths.LogPath for that).
 
static LogSplittingType SplittingType [get, set]
 

Events

static EventHandler< LogEventArgsLogged
 Occurs after a message has been logged.
 
static EventHandler
< CrashedEventArgs
Crashed
 Occurs when the server "crashes" (has an unhandled exception). Note that such occurences will not always cause shutdowns - check ShutdownImminent property. Reporting of the crash may be suppressed.
 

Detailed Description

Central logging class. Logs to file, relays messages to the frontend, submits crash reports.

Member Function Documentation

static void fCraft.Logger.DisableFileLogging ( )
static

Disables all file logging (sets all LogFileOptions to false).

static void fCraft.Logger.Log ( LogType  type,
[NotNull] string  message,
[NotNull] params object[]  args 
)
static

Adds a message to the server log. Depending on server configuration and log category, message can be shown in console, logged to file, both, or neither.

Parameters
typeType of message.
messageFormat string for the message. Uses same syntax as String.Format.
argsAn System.Object array containing zero or more objects to format.
Exceptions
ArgumentNullExceptionMessage or args is null.
FormatExceptionString.Format rejected formatting.
static void fCraft.Logger.LogAndReportCrash ( [CanBeNull] string  message,
[CanBeNull] string  assembly,
[CanBeNull] Exception  exception,
bool  shutdownImminent 
)
static

Logs and reports a crash or an unhandled exception. Details are logged, and a crash report may be submitted to fCraft.net. Note that this method may take several seconds to finish, since it gathers system information and possibly communicates to fCraft.net.

Parameters
messageDescription/context of the crash. May be null if unknown.
assemblyAssembly or component where the crash/exception was caught. May be null if unknown.
exceptionException. May be null.
shutdownImminentWhether this crash will likely report in a server shutdown. Used for Logger.Crashed event.
static void fCraft.Logger.LogToConsole ( [NotNull] string  message)
static

Logs a message of type ConsoleOutput, strips colors, and splits into multiple messages at newlines. Use this method for all messages of LogType.ConsoleOutput

Member Data Documentation

readonly bool [] fCraft.Logger.ConsoleOptions
static
readonly bool [] fCraft.Logger.LogFileOptions
static

Property Documentation

string fCraft.Logger.CurrentLogFileName
staticget

Name of the file that log messages are currently being written to. Does not include path to the log folder (see Paths.LogPath for that).

bool fCraft.Logger.Enabled
staticgetset

Gets or sets whether logging is globally enabled/disabled. If "&ndash;nolog" command-line argument is given, logging is disabled.

LogSplittingType fCraft.Logger.SplittingType
staticgetset

Event Documentation

EventHandler<CrashedEventArgs> fCraft.Logger.Crashed
static

Occurs when the server "crashes" (has an unhandled exception). Note that such occurences will not always cause shutdowns - check ShutdownImminent property. Reporting of the crash may be suppressed.

EventHandler<LogEventArgs> fCraft.Logger.Logged
static

Occurs after a message has been logged.


The documentation for this class was generated from the following file: