To use ALox, you need to
Altogether this should not be too difficult to set up and this does not differ from the use of other C# libraries.
Currently, ALox provides ready to use IDE projects for
If you compile your C# code with a different build system, all you need to know is two things:
Unpack the ALox distribution (e.g. as zip) from Alox at GitHub and move all its contents to a place where you commonly store 3rd party libraries your projects are using.
In this tutorial, we call this folder the ALOX_LIB_PATH. After downloading and unpacking ALox within the folder ALOX_LIB_PATH you should find at least the following subfolders:
ALOX_LIB_PATH\src.cs ALOX_LIB_PATH\build ALOX_LIB_PATH\html
As mentioned above, for three different IDEs pre-configured projects exists.
You have to add the library projects to the solution that includes the project you want to equip with ALox.
If you do not actually have a C# project (or do not want to touch it now), there are ready to use sample solutions for Mono Develop and Microsoft Visual Studio available. They are found in:
ALOX_LIB_PATH/build/ide.cs.vstudio/Solution/ALox-CS.VStudio.sln ALOX_LIB_PATH/build/ide.cs.monodevelop/Solution/ALox-CS.Mono.sln ALOX_LIB_PATH/build/ide.cs.rider/Solution/ALox-CS.Rider.sln
Choose the right class library project that fits well to your own project target and platform.
Your, choices are:
ALox-CS-.Net45-DLL | For .Net 4.5 projects that do not use ALox release logging |
ALox-CS-.Net45-DLL-Release-Log | For .Net 4.5 projects that intent to use ALox release logging (besides debug logging) |
ALox-CS-.WP80-DLL | For windows Phone 8 projects that do not use ALox release logging |
ALox-CS-.WP80-DLL-Release-Log | For windows Phone 8 projects that intent to use ALox release logging (besides debug logging) |
Sounds complicated, but isn't! Just go with the release-log enabled version for now! Choosing the other one is indicated if distribution size matters.
Set a build dependency from your project to the just added ALox-CS-DLL project. and add the ALox-CS-DLL project as a reference to your project.
If
the sources of ALox are found in the following two folders and their subfolders:
ALOX_LIB_PATH/src.cs/alib ALOX_LIB_PATH/src.cs/alox
Unit tests (which do not belong into the library) are found in:
ALOX_LIB_PATH/src.cs/alib.unittests ALOX_LIB_PATH/src.cs/alox.unittests
Now, as ALox is a part of your IDEs solution or build system, the final step is to set compilation symbols within your own project (!), hence the one that is supposed to use ALox. Different settings are needed for the debug and release configurations.
Please find an overview over all compilation symbols introduced by ALox here: Conditional Compilation Symbols.
The following step by step guide examples this for Visual Studio:
Now close the project properties and continue with adjusting the references of your project:
In the now open dialog navigate to section "Assemblies" and here choose "Framework".
Make sure that you have ticked the check boxes for:
To test your setup, add minimum ALox functionality to your project as described in the first chapter of ALox for C# Tutorial into your main method or anywhere you think it is appropriate:
Log.Info( "Hello ALox" );
You are set if:
In addition to setting up the project, the format of the log output of ALox should be recognizable by your IDE: the source code file name and line number that generated the output should become "clickable" in the log: It should link back to the source in the editor.
While different IDEs have different abilities and syntax for that, unfortunately, there are some IDEs that do not support such "clickable log output" at all.
This chapter gives some tips for different IDEs. We hope that the IDE you are using is listed here and it supports this feature. Otherwise, it may need a little testing, maybe some trial and error process, to see how the output needs to be done to be properly consumed by your IDE.
As far as we know, clickable log output is only possible to have when launching a project in debug mode. In this case, ALox automatically adds a second logger of type CLRDebuggerLogger. (This is the default behavior by default, implemented with method Log.AddDebugLogger.)
This logger does everything right to have clickable log lines in Visual Studio. No adjustments need to be done.
MonoDevelop does not support linking log output back to source code. Also, no colorful log output is supported. The configuration should reflect this and suppress colorful loggers by setting variable ALOX_CONSOLE_TYPE to "plain"
.
CONSOLE_TYPE= plain
JetBrains Rider has an intelligent output console that supports ANSI colors and detects links to files when they are given with full path name.
There is one specialty about the ANSI color support: Rider does not support light colors. Therefore, the use of light colors has to be switched off. If this is not done, colors are in most cases not effective.
Furthermore, the use of an C# CLRDebuggerLogger needs to be switched off. This is done by setting configuration variable NO_IDE_LOGGER.
As a summary, these or similar configuration variable settings are recommended:
[ALOX] NO_IDE_LOGGER= true CONSOLE_TYPE= ANSI CONSOLE_LIGHT_COLORS= never DEBUG_LOGGER_FORMAT= %SF(%SL):%A5%SM() %A5[%TC +%TL][%tN][%D]%A1(%#): %V, \ \e[31m, \ \e[34m, \ , \ \e[33m