Comments (3)
WikiClientLibrary.ILogger
will be removed, and a new interface such as IWikiClientLoggable
will be introduced, like this
interface IWikiClientLoggable
{
void SetLoggerFactory(ILoggerFactory factory);
}
from wikiclientlibrary.
For a better clarity, I will take use of the "scope" feature MEL provides. The new IWikiClientLoggable
would be like this
interface IWikiClientLoggable
{
ILogger Logger { get; set; }
}
To begin with, I am worried about the multi-threading behavior of scopes, but later I took a look at MS's implementation of ILogger
,[1] which uses AsyncLocal<T>
to keep track of the current scope.[2] Perhaps I can count on this.
Under the new design, client only needs to pass ILogger
instances to WikiClient
and WikiSite
, respectively and . Other classes, such as WikiSite
can implicitly use WikiClient
's logger on initializationWikiPage
, will just use WikiSite
's logger, but in a different scope.
from wikiclientlibrary.
With the new scoped logging, the emitted log looks like
Trace: WikiClientLibrary.Client.WikiClient
-> WikiClient#17363659 -> ::InvokeAsync(452849D100000001)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> WikiClient#17363659 -> ::InvokeAsync(452849D100000002)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> WikiClient#17363659 -> ::InvokeAsync(452849D100000002)
HTTP 200, elapsed: 00:00:01.5715946
Trace: WikiClientLibrary.Client.WikiClient
-> WikiClient#17363659 -> ::InvokeAsync(452849D100000001)
HTTP 200, elapsed: 00:00:01.8922563
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> ::LoginAsync(XuesongBot) -> Wikipedia -> ::FetchTokenAsyncCore(login)
Sending request 452849D100000003, SuppressAccountAssertion=True
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LoginAsync(XuesongBot) -> Wikipedia -> ::FetchTokenAsyncCore(login) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000003)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LoginAsync(XuesongBot) -> Wikipedia -> ::FetchTokenAsyncCore(login) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000003)
HTTP 200, elapsed: 00:00:00.3799395
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> ::LoginAsync(XuesongBot)
Sending request 452849D100000004, SuppressAccountAssertion=True
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LoginAsync(XuesongBot) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000004)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LoginAsync(XuesongBot) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000004)
HTTP 200, elapsed: 00:00:01.3669340
Warning: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LoginAsync(XuesongBot) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000004)
API warning [main]: "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes. Use [[Special:ApiFeatureUsage]] to see usage of deprecated features by your application."
Warning: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LoginAsync(XuesongBot) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000004)
API warning [login]: "*": "Main-account login via \"action=login\" is deprecated and may stop working without warning. To continue login with \"action=login\", see [[Special:BotPasswords]]. To safely continue using main-account login, see \"action=clientlogin\"."
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> ::LoginAsync(XuesongBot) -> Wikipedia -> ::RefreshAccountInfoAsync()
Sending request 452849D100000005, SuppressAccountAssertion=True
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LoginAsync(XuesongBot) -> Wikipedia -> ::RefreshAccountInfoAsync() -> WikiClient#17363659 -> ::InvokeAsync(452849D100000005)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LoginAsync(XuesongBot) -> Wikipedia -> ::RefreshAccountInfoAsync() -> WikiClient#17363659 -> ::InvokeAsync(452849D100000005)
HTTP 200, elapsed: 00:00:00.3718677
Information: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> ::LoginAsync(XuesongBot)
Logged in as XuesongBot.
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> [WikiPage{Wikipedia:Sandbox}]::RefreshPagesAsync(FetchContent)
Fetching 1 pages.
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> [WikiPage{Wikipedia:Sandbox}]::RefreshPagesAsync(FetchContent)
Sending request 452849D100000006, SuppressAccountAssertion=False
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> [WikiPage{Wikipedia:Sandbox}]::RefreshPagesAsync(FetchContent) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000006)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> [WikiPage{Wikipedia:Sandbox}]::RefreshPagesAsync(FetchContent) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000006)
HTTP 200, elapsed: 00:00:00.4243953
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> WikiPage{Wikipedia:Sandbox}::UpdateContentAsync()
Edit: Wikipedia:Sandbox#51235807: Waiting for delay 00:00:05.
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> WikiPage{Wikipedia:Sandbox}::UpdateContentAsync() -> Wikipedia -> ::FetchTokenAsyncCore(csrf)
Sending request 452849D100000008, SuppressAccountAssertion=True
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> WikiPage{Wikipedia:Sandbox}::UpdateContentAsync() -> Wikipedia -> ::FetchTokenAsyncCore(csrf) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000008)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> WikiPage{Wikipedia:Sandbox}::UpdateContentAsync() -> Wikipedia -> ::FetchTokenAsyncCore(csrf) -> WikiClient#17363659 -> ::InvokeAsync(452849D100000008)
HTTP 200, elapsed: 00:00:00.3663925
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> WikiPage{Wikipedia:Sandbox}::UpdateContentAsync()
Sending request 452849D100000007, SuppressAccountAssertion=False
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> WikiPage{Wikipedia:Sandbox}::UpdateContentAsync() -> WikiClient#17363659 -> ::InvokeAsync(452849D100000007)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> WikiPage{Wikipedia:Sandbox}::UpdateContentAsync() -> WikiClient#17363659 -> ::InvokeAsync(452849D100000007)
HTTP 200, elapsed: 00:00:00.5573600
Information: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> WikiPage{Wikipedia:Sandbox}::UpdateContentAsync()
Edited page. New revid=329827.
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> ::LogoutAsync()
Sending request 452849D100000009, SuppressAccountAssertion=True
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LogoutAsync() -> WikiClient#17363659 -> ::InvokeAsync(452849D100000009)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LogoutAsync() -> WikiClient#17363659 -> ::InvokeAsync(452849D100000009)
HTTP 200, elapsed: 00:00:00.4894650
Debug: WikiClientLibrary.Sites.WikiSite
-> Wikipedia -> ::LogoutAsync() -> Wikipedia -> ::RefreshAccountInfoAsync()
Sending request 452849D10000000A, SuppressAccountAssertion=True
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LogoutAsync() -> Wikipedia -> ::RefreshAccountInfoAsync() -> WikiClient#17363659 -> ::InvokeAsync(452849D10000000A)
Initiate request to: https://test2.wikipedia.org/w/api.php.
Trace: WikiClientLibrary.Client.WikiClient
-> Wikipedia -> ::LogoutAsync() -> Wikipedia -> ::RefreshAccountInfoAsync() -> WikiClient#17363659 -> ::InvokeAsync(452849D10000000A)
HTTP 200, elapsed: 00:00:00.3658774
from wikiclientlibrary.
Related Issues (20)
- Support lexicographical data (lexemes) HOT 2
- Getting list of items from lists that can't be used with generators
- ArgumentException for WbGlobeCoordinate with precision = null HOT 1
- FileInfoPropertyProvider and extmetadata improvements
- Enity SiteLink URL is always null HOT 1
- [QUESTION] Is it possible to run 'action=cargoquery' queries? HOT 19
- Dropping support for .NET Standard 1.x and 2.0 HOT 16
- MediaWiki 1.19 test wiki is gone HOT 2
- Backport "Log outs FANDOM with action=logout"-commit to v0.7.x HOT 3
- RefreshAsync(PageQueryOptions.FetchContent) does not fetch page content
- Debian package release adds +dfsg to revision number, breaking version parsing HOT 12
- Failed to enumerate category members on enwarriorswiki:Category:Spotfur's Rebellion HOT 3
- SiteInfo.MagicWords is not filled by anything HOT 1
- RecentChangesEnumerator not properly populating all results HOT 6
- How do you get, say, the wanted templates? HOT 2
- Problem getting list of "wanted" items when there are none HOT 4
- Issue with InterwikiMap HOT 1
- WikiPage constructor hangs HOT 2
- Make WikibaseRequestHelper public HOT 3
- Load and save entities from JSON HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wikiclientlibrary.