magic.lambda.logging
13.3.0
See the version list below for details.
dotnet add package magic.lambda.logging --version 13.3.0
NuGet\Install-Package magic.lambda.logging -Version 13.3.0
<PackageReference Include="magic.lambda.logging" Version="13.3.0" />
paket add magic.lambda.logging --version 13.3.0
#r "nuget: magic.lambda.logging, 13.3.0"
// Install magic.lambda.logging as a Cake Addin #addin nuget:?package=magic.lambda.logging&version=13.3.0 // Install magic.lambda.logging as a Cake Tool #tool nuget:?package=magic.lambda.logging&version=13.3.0
Audit logging from Hyperlambda
Logging wrapper slots for Magic. More specifically, this project provides the following slots allowing you to create log entries.
- [log.info] - Information log entries, typically smaller pieces of information
- [log.debug] - Debug log entries, typically additional debugging information not enabled in production
- [log.error] - Error log entries, typically exceptions
- [log.fatal] - Fatal log entries, from which the application cannot recover from
In addition to the above slots there are also slots that allows you to retrieve log items, and/or some basic statistics from your log. These can be found below.
- [log.count] - Counts number of log items, optionally matching the specified filter condition
- [log.get] - Returns the log item with the specified id
- [log.query] - Returns a list of log items according to its arguments
- [log.capabilities] - Returns the capabilities of the log implementation
By default, this project will log into your magic.log_entries
database/table, using either MySQL, PostgreSQL, or
Microsoft SQL Server. This allows you to use SQL to generate statistics on top of your logs. However, the project
also allows for using NoSQL database systems as your log implementation, and/or any other types of implementation
you see fit. An example of logging an info piece of information can be found below.
log.info:Howdy world from magic.lambda.logging
You can supply content to your log item two different ways. Either as a piece of string, or if you choose to set its value to nothing, it will concatenate all children node's values, after having evaluated it as a lambda object. This allows you to create rich log entries, based upon evaluating the children of the log invocation. This gives you a convenience shortcut to create log entries that have strings concatenated as their content, without having to manually concatenate them yourself. An example of the latter can be found below.
.a:foo bar
log.info
.:"A's value is "
get-value:x:@.a
If you provide a value for your log invocation, then children nodes will be assumed to be "meta information" associated with the invocation, allowing you to log data such as follows.
log.info:Some log entry
username:foo
ip:123.123.123.123
The above will log "some log entry" for you, and associate [username] and [ip] with your log entry as meta data. This allows you to use the same log entry for similar log types, and parametrise your log entry with meta information, giving you aggregate capabilities on log entries having the same content, while still preserving meta information unique to each log entry. Notice, if you don't provide a value to your log invocation, no meta data will be associated with your log entry, but all arguments will rather be concatenated as a single string and end up in the "content" parts of your log entry after having been evaluated.
Exception logging
The [log.error] and [log.fatal] slots give you the option of logging an exception stack trace, by parametrising your invocation with an [exception] argument, which will not be assumed to be meta information, but rather end up in the "exception" column as you create the log item. All other parameters will still be evaluated or used as meta information.
Log level configuration
The slots [log.debug], [log.info], [log.error], and [log.fatal] are actually logging with their last parts becoming the "type" of log item. This is similar to how Log4Net and Log4J works, and can be turned on and off as you see fit. The level is an increasing leverage type of value, applied in the following order.
- debug
- info
- error
- fatal
This implies that if you set the level to for instance "error" no invocations to [log.debug] or [log.info] will log anything into your log, allowing you to "turn up and down" the level of logging you need as a configuration setting through your "appsetting.json" file. Below is an example configuration setting the level to "info". The default value for log level is "debug". In a production environment you might want to increase this to at least "info".
{
"magic": {
"logging": {
"level": "info"
}
}
}
The above value will for instance log everything except invocations to [log.debug].
Querying your log
Notice - To see the capabilities of your particular log implementation please invoke [log.capabilities] and verify your particular log implementation can actually do what you need for it to do, since not all implementations have the same capabilities - Implying things such as filtering log items according to content, and/or timeshifting log items, etc, might not be implemented for your particular implementation.
To retrieve log items sequentially you can use [log.query]. This slot can optionally take a [from] argument being the id of an existing log item from where to start retrieving items, and a [max] argument being the maximum number of records to return. If no [max] argument is specified, the default value of this is 10. In addition the invocation can be fiven a string as its value, which if given must match the content of your log items for an item to be returned. Below is an example of usage.
log.query:"We successfully authenticated user 'root'"
from:555
max:20
The above will return log items starting from id 554 and down, and return only 20 records, and all returned records will have a content value of "We successfully authenticated user 'root'". To return a single log item you can use [log.get] and pass in the id of the log item you want to retrieve as its value.
Notice - If your particular log implementation does not support querying you cannot query items according to content as illustrated above, but rather only page items. Invoke [log.capabilities] to see if your implementation supports querying before relying upon its existence.
Project website
The source code for this repository can be found at github.com/polterguy/magic.lambda.logging, and you can provide feedback, provide bug reports, etc at the same place.
Quality gates
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- magic.data.common (>= 13.3.0)
- magic.node.extensions (>= 13.3.0)
- magic.signals.contracts (>= 13.3.0)
- Newtonsoft.Json (>= 13.0.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on magic.lambda.logging:
Package | Downloads |
---|---|
magic.library
Helper project for Magic to wire up everything easily by simply adding one package, and invoking two simple methods. When using Magic, this is (probably) the only package you should actually add, since this package pulls in everything else you'll need automatically, and wires up everything sanely by default. To use package go to https://polterguy.github.io |
|
magic.lambda.scheduler
Helper slots for Magic to allow you to dynamically create tasks, either as a part of your custom workflow, and/or as scheduled tasks intended to be executed at some interval, or future time. To use package go to https://polterguy.github.io |
|
magic.lambda.sockets
Web socket helper project for Magic, giving you support for web sockets connections from and to Hyperlambda. To use package go to https://polterguy.github.io |
|
magic.data.cql
CQL data adapters for Magic to store files and folders, etc. To use package go to https://polterguy.github.io |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
17.2.0 | 522 | 1/22/2024 |
17.1.7 | 268 | 1/12/2024 |
17.1.6 | 250 | 1/11/2024 |
17.1.5 | 240 | 1/5/2024 |
17.0.1 | 299 | 1/1/2024 |
17.0.0 | 730 | 12/14/2023 |
16.11.5 | 736 | 11/12/2023 |
16.9.0 | 740 | 10/9/2023 |
16.7.0 | 1,183 | 7/11/2023 |
16.4.1 | 975 | 7/2/2023 |
16.4.0 | 1,036 | 6/22/2023 |
16.3.1 | 1,040 | 6/7/2023 |
16.3.0 | 1,020 | 5/28/2023 |
16.1.9 | 1,337 | 4/30/2023 |
15.10.11 | 1,313 | 4/13/2023 |
15.9.1 | 1,404 | 3/27/2023 |
15.9.0 | 1,252 | 3/24/2023 |
15.8.2 | 1,323 | 3/20/2023 |
15.7.0 | 1,237 | 3/6/2023 |
15.5.0 | 2,696 | 1/28/2023 |
15.2.0 | 1,812 | 1/18/2023 |
15.1.0 | 2,322 | 12/28/2022 |
14.5.7 | 1,902 | 12/13/2022 |
14.5.5 | 2,060 | 12/6/2022 |
14.5.1 | 2,040 | 11/23/2022 |
14.5.0 | 1,947 | 11/18/2022 |
14.4.5 | 2,231 | 10/22/2022 |
14.4.1 | 2,263 | 10/22/2022 |
14.4.0 | 2,213 | 10/17/2022 |
14.3.1 | 2,654 | 9/12/2022 |
14.3.0 | 1,999 | 9/10/2022 |
14.1.3 | 2,309 | 8/7/2022 |
14.1.2 | 2,033 | 8/7/2022 |
14.1.1 | 1,928 | 8/7/2022 |
14.0.14 | 2,043 | 7/26/2022 |
14.0.12 | 2,012 | 7/24/2022 |
14.0.11 | 2,016 | 7/23/2022 |
14.0.10 | 2,044 | 7/23/2022 |
14.0.9 | 2,038 | 7/23/2022 |
14.0.8 | 2,072 | 7/17/2022 |
14.0.5 | 2,109 | 7/11/2022 |
14.0.4 | 2,116 | 7/6/2022 |
14.0.3 | 2,103 | 7/2/2022 |
14.0.2 | 2,010 | 7/2/2022 |
14.0.0 | 2,274 | 6/25/2022 |
13.4.0 | 3,686 | 5/31/2022 |
13.3.4 | 2,780 | 5/9/2022 |
13.3.1 | 2,109 | 5/1/2022 |
13.3.0 | 2,095 | 5/1/2022 |
13.2.0 | 2,573 | 4/21/2022 |
13.1.0 | 2,401 | 4/7/2022 |
13.0.0 | 2,095 | 4/5/2022 |
11.0.5 | 2,840 | 3/2/2022 |
11.0.4 | 2,117 | 2/22/2022 |
11.0.3 | 2,170 | 2/9/2022 |
11.0.2 | 2,162 | 2/6/2022 |
11.0.1 | 520 | 2/5/2022 |
11.0.0 | 2,146 | 2/5/2022 |
10.0.21 | 2,156 | 1/28/2022 |
10.0.20 | 2,182 | 1/27/2022 |
10.0.19 | 2,100 | 1/23/2022 |
10.0.18 | 1,862 | 1/17/2022 |
10.0.16 | 748 | 1/14/2022 |
10.0.15 | 1,628 | 12/31/2021 |
10.0.14 | 1,362 | 12/28/2021 |
10.0.7 | 2,182 | 12/22/2021 |
10.0.5 | 1,502 | 12/18/2021 |
9.9.9 | 2,341 | 11/29/2021 |
9.9.3 | 1,759 | 11/9/2021 |
9.9.2 | 1,443 | 11/4/2021 |
9.9.0 | 1,580 | 10/30/2021 |
9.8.9 | 912 | 10/29/2021 |
9.8.7 | 861 | 10/27/2021 |
9.8.6 | 846 | 10/27/2021 |
9.8.5 | 908 | 10/26/2021 |
9.8.0 | 1,569 | 10/20/2021 |
9.7.9 | 761 | 10/19/2021 |
9.7.5 | 1,675 | 10/14/2021 |
9.7.0 | 1,074 | 10/9/2021 |
9.6.6 | 1,248 | 8/14/2021 |
9.2.0 | 6,655 | 5/26/2021 |
9.1.4 | 1,478 | 4/21/2021 |
9.1.0 | 1,238 | 4/14/2021 |
9.0.0 | 1,027 | 4/5/2021 |
8.9.9 | 1,194 | 3/30/2021 |
8.9.3 | 1,767 | 3/19/2021 |
8.9.2 | 1,222 | 1/29/2021 |
8.9.1 | 1,225 | 1/24/2021 |
8.9.0 | 1,279 | 1/22/2021 |
8.6.9 | 3,195 | 11/8/2020 |
8.6.7 | 1,233 | 11/4/2020 |
8.6.6 | 1,447 | 11/2/2020 |
8.6.0 | 4,242 | 10/28/2020 |
8.5.0 | 2,091 | 10/23/2020 |
8.4.0 | 5,811 | 10/13/2020 |
8.3.1 | 3,044 | 10/5/2020 |
8.3.0 | 1,450 | 10/3/2020 |
8.2.2 | 2,272 | 9/26/2020 |
8.2.1 | 1,573 | 9/25/2020 |
8.2.0 | 1,473 | 9/25/2020 |
8.1.17 | 6,875 | 9/13/2020 |
8.1.16 | 658 | 9/13/2020 |
8.1.15 | 2,301 | 9/12/2020 |
8.1.11 | 2,749 | 9/11/2020 |
8.1.10 | 1,542 | 9/6/2020 |
8.1.9 | 1,551 | 9/3/2020 |
8.1.8 | 1,482 | 9/2/2020 |
8.1.7 | 1,428 | 8/28/2020 |
8.1.4 | 1,448 | 8/25/2020 |
8.1.3 | 1,439 | 8/18/2020 |
8.1.2 | 1,489 | 8/16/2020 |
8.1.1 | 1,528 | 8/15/2020 |
8.1.0 | 570 | 8/15/2020 |
8.0.1 | 2,680 | 8/7/2020 |
8.0.0 | 1,245 | 8/7/2020 |
7.0.1 | 1,372 | 6/28/2020 |
7.0.0 | 1,235 | 6/28/2020 |
5.0.1 | 3,348 | 5/29/2020 |
5.0.0 | 4,684 | 2/25/2020 |
4.0.4 | 7,852 | 1/27/2020 |
4.0.3 | 1,265 | 1/27/2020 |
4.0.2 | 1,410 | 1/16/2020 |
4.0.1 | 1,415 | 1/11/2020 |
4.0.0 | 1,389 | 1/5/2020 |
3.1.0 | 6,302 | 11/10/2019 |
3.0.0 | 3,865 | 10/23/2019 |
2.0.1 | 8,213 | 10/15/2019 |
2.0.0 | 1,625 | 10/13/2019 |
1.1.9 | 1,348 | 10/11/2019 |
1.1.8 | 1,301 | 10/10/2019 |
1.1.7 | 589 | 10/9/2019 |
1.1.6 | 580 | 10/6/2019 |
1.1.5 | 627 | 10/6/2019 |
1.1.4 | 617 | 10/6/2019 |
1.1.2 | 605 | 10/5/2019 |
1.0.0 | 650 | 9/26/2019 |