mirror of https://github.com/deavmi/dlog.git
parent
986a3d3bdf
commit
49f1f70f28
|
@ -10,38 +10,89 @@
|
||||||
module dlog.basic;
|
module dlog.basic;
|
||||||
|
|
||||||
import dlog.core;
|
import dlog.core;
|
||||||
|
import std.stdio : File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a basic message
|
||||||
|
* with log level information
|
||||||
|
* associated with it as well
|
||||||
|
* as text
|
||||||
|
*/
|
||||||
public class BasicMessage : Message
|
public class BasicMessage : Message
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The text message
|
||||||
|
*/
|
||||||
private string text;
|
private string text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log level
|
||||||
|
*/
|
||||||
private Level level;
|
private Level level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new `BasicMessage`
|
||||||
|
* with the given text and log level
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* text = the message text
|
||||||
|
* level = the log level (default
|
||||||
|
* is `Level.INFO`)
|
||||||
|
*/
|
||||||
this(string text, Level level = Level.INFO)
|
this(string text, Level level = Level.INFO)
|
||||||
{
|
{
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an empty message
|
||||||
|
* with the highest log level
|
||||||
|
* (least verbose)
|
||||||
|
*/
|
||||||
this()
|
this()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the text
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* text = the message's
|
||||||
|
* text
|
||||||
|
*/
|
||||||
public void setText(string text)
|
public void setText(string text)
|
||||||
{
|
{
|
||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the text
|
||||||
|
*
|
||||||
|
* Returns: the text
|
||||||
|
*/
|
||||||
public string getText()
|
public string getText()
|
||||||
{
|
{
|
||||||
return this.text;
|
return this.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the log level
|
||||||
|
*
|
||||||
|
* Returns: the level
|
||||||
|
*/
|
||||||
public Level getLevel()
|
public Level getLevel()
|
||||||
{
|
{
|
||||||
return this.level;
|
return this.level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the log level
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* level = the level
|
||||||
|
*/
|
||||||
public void setLevel(Level level)
|
public void setLevel(Level level)
|
||||||
{
|
{
|
||||||
this.level = level;
|
this.level = level;
|
||||||
|
@ -50,7 +101,7 @@ public class BasicMessage : Message
|
||||||
|
|
||||||
public class FileHandler : Handler
|
public class FileHandler : Handler
|
||||||
{
|
{
|
||||||
import std.stdio : File;
|
|
||||||
private File file;
|
private File file;
|
||||||
this(File file)
|
this(File file)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue