diff --git a/source/dlog/core.d b/source/dlog/core.d index 5652193..611ad34 100644 --- a/source/dlog/core.d +++ b/source/dlog/core.d @@ -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 diff --git a/source/dlog/package.d b/source/dlog/package.d index 78dd292..7174a4c 100644 --- a/source/dlog/package.d +++ b/source/dlog/package.d @@ -9,3 +9,4 @@ public import dlog.core; public import dlog.transform; public import dlog.defaults; public import dlog.context; +public import dlog.utilities; diff --git a/source/dlog/utilities.d b/source/dlog/utilities.d new file mode 100644 index 0000000..bb15816 --- /dev/null +++ b/source/dlog/utilities.d @@ -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; +} \ No newline at end of file