feat: add logging definitions.
This commit is contained in:
parent
0059fc43e1
commit
81184c23a7
2 changed files with 20 additions and 0 deletions
|
@ -98,6 +98,24 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks {
|
|||
List<BaseItem> results = new List<BaseItem>();
|
||||
Expression expression = new Parser(StringTokenStream.generate(smartPlaylist.Program)).parse(); // parse here, so that we don't repeat the work for each item
|
||||
Executor executor = new Executor(new DefaultEnvironment());
|
||||
|
||||
executor.builtins["logd"] = (x) => {
|
||||
_logger.LogDebug(((Lisp.String)x.First()).Value(), x.Skip(1).ToArray());
|
||||
return Lisp_Boolean.TRUE;
|
||||
};
|
||||
executor.builtins["logi"] = (x) => {
|
||||
_logger.LogInformation(((Lisp.String)x.First()).Value(), x.Skip(1).ToArray());
|
||||
return Lisp_Boolean.TRUE;
|
||||
};
|
||||
executor.builtins["logw"] = (x) => {
|
||||
_logger.LogWarning(((Lisp.String)x.First()).Value(), x.Skip(1).ToArray());
|
||||
return Lisp_Boolean.TRUE;
|
||||
};
|
||||
executor.builtins["loge"] = (x) => {
|
||||
_logger.LogError(((Lisp.String)x.First()).Value(), x.Skip(1).ToArray());
|
||||
return Lisp_Boolean.TRUE;
|
||||
};
|
||||
|
||||
executor.environment.Set("user", Lisp_Object.FromBase(user));
|
||||
if (Plugin.Instance is not null) {
|
||||
executor.eval(Plugin.Instance.Configuration.InitialProgram);
|
||||
|
|
|
@ -129,6 +129,8 @@ the items by name you could use the following program:
|
|||
- **is-type**: matches the type of item look at
|
||||
[BaseItemKind.cs](https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Data/Enums/BaseItemKind.cs)
|
||||
for a list of items. The plugin has enabled support for `Audio, MusicAlbum, Playlist` (`(is-type "Audio")`)
|
||||
- **log[diwe]**: write to the logger with the respective levels (`debug`, `information`, `warning`, `error`).
|
||||
Takes the same arguments as `Logger.LogInformation(...)`.
|
||||
|
||||
### Filename
|
||||
|
||||
|
|
Loading…
Reference in a new issue