mirror of https://github.com/deavmi/dlog.git
Utilities
- Moved `flatten()` to the `dlog.utilities` module Package - Updated package to import `dlog.utilities` Core - Import `flatten` from `dlog.utilities`
This commit is contained in:
parent
28c546ff16
commit
7e10495862
|
@ -10,6 +10,7 @@ import std.range : join;
|
|||
import dlog.transform : MessageTransform;
|
||||
import dlog.defaults;
|
||||
import dlog.context : Context, CompilationInfo;
|
||||
import dlog.utilities : flatten;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
|
@ -43,32 +44,6 @@ public class Logger
|
|||
this.multiArgJoiner = multiArgJoiner;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given an arbitrary amount of arguments, convert each to a string
|
||||
* and return that as an array
|
||||
*
|
||||
* Params:
|
||||
* segments = alias sequence
|
||||
* Returns: a flattened string[]
|
||||
*/
|
||||
public static string[] flatten(TextType...)(TextType segments)
|
||||
{
|
||||
/* The flattened components */
|
||||
string[] components;
|
||||
|
||||
/* Flatten the components */
|
||||
static foreach(messageComponent; segments)
|
||||
{
|
||||
components ~= to!(string)(messageComponent);
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an arbitrary amount of arguments, convert each to a string
|
||||
* and return it as an array joined by the joiner
|
||||
|
|
|
@ -9,3 +9,4 @@ public import dlog.core;
|
|||
public import dlog.transform;
|
||||
public import dlog.defaults;
|
||||
public import dlog.context;
|
||||
public import dlog.utilities;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
module dlog.utilities;
|
||||
|
||||
/**
|
||||
* Given an arbitrary amount of arguments, convert each to a string
|
||||
* and return that as an array
|
||||
*
|
||||
* Params:
|
||||
* segments = alias sequence
|
||||
* Returns: a flattened string[]
|
||||
*/
|
||||
public string[] flatten(TextType...)(TextType segments)
|
||||
{
|
||||
/* The flattened components */
|
||||
string[] components;
|
||||
|
||||
/* Flatten the components */
|
||||
static foreach(messageComponent; segments)
|
||||
{
|
||||
components ~= to!(string)(messageComponent);
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
Loading…
Reference in New Issue