Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Package for last commits (NLog/Serilog) #56

Closed
blafa opened this issue May 23, 2018 · 9 comments
Closed

New Package for last commits (NLog/Serilog) #56

blafa opened this issue May 23, 2018 · 9 comments

Comments

@blafa
Copy link

blafa commented May 23, 2018

Hi. First of all: cool project!
When is next NuGet-Package update planned? I would really love to use my own Logger which is not possible with the current Version but should be with the next one (commit ae9bb7e) :)
thanks

@zlzforever
Copy link
Collaborator

zlzforever commented May 23, 2018

@blafa I am working on a big re-factory:

  1. use Serilog instead of NLog, because there are a lot of extensions for Serilog like ES, Mongodb, MQ
  2. right now Env class are static and all config fields are static, i want to implement one spider use one Env, then if i changed config file will not impact the running spider.
  3. upgrade all methods to async
  4. add more test cases
    So i think i will not update nuget-package very quickly. If you want to use the next one, you can build and push it to your private NUGET server or local nuget.

@blafa
Copy link
Author

blafa commented May 23, 2018

Hi. Thanks for the Info. One small input: you could maybe inject ILogger (Microsoft.Extensions.Logging: https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.ilogger?view=aspnetcore-2.0) instead of hardcode Serilog dependency. Serilog provides and extension for Microsoft.Extensions.Logging (https://github.com/serilog/serilog-extensions-logging)

@blafa blafa closed this as completed May 23, 2018
@zlzforever
Copy link
Collaborator

Thanks, i will consider that.

@blafa
Copy link
Author

blafa commented Sep 9, 2018

Hi. Can you estimate when your big refactoring is pushed? Have you tried to run dotnetspider in docker? :)

@blafa blafa reopened this Sep 9, 2018
@zlzforever
Copy link
Collaborator

Plan to push a new release this month. Didn't try it in docker, but i think it can work in docker.

@blafa
Copy link
Author

blafa commented Sep 10, 2018

Wow cool! It works on docker except of one chromedriver issue. I will try it after the new release.
Maybe you can do the ChromeDriver path configurable if you didn't change it already ;-)

@zlzforever
Copy link
Collaborator

thx for your reminder. i will have a test.

@zlzforever
Copy link
Collaborator

@blafa right now, i split log module from downloader, pipeline, processor. Now you can use any log library like Nlog/ Serilog. Please see Appbase

		static AppBase()
		{
			LoggerFactory = new LoggerFactory();

			var loggerConfiguration = new LoggerConfiguration()
				.MinimumLevel.Verbose()
				.WriteTo.Console(theme: Theme)
				.WriteTo.RollingFile("dotnetspider.log");
			Log.Logger = loggerConfiguration.CreateLogger();
			LoggerFactory.AddSerilog();
		}

So if you want use NLog, then you can set the new LogFactory before run spider

Appbase.LoggerFactory = new LoggerFactory();
Appbase.LoggerFactory.AddNLog();

If any issue, please report to me. Thank you.

@blafa
Copy link
Author

blafa commented Sep 12, 2018

@zlzforever perfect, thx!

  1. Could you make Path to ChromeDriver (Env.BaseDirectory) configurable? Could be important when running on docker. At the moment you must to put chromedriver.exe (resp. chromedriver for linux) in bin/Debug/netcoreapp2.1. Would be nicer to have this Path configurable..
  2. If possible provide options for "--no-sandbox" and "--disable-dev-shm-usage" (could also be important for docker-environment)

@blafa blafa closed this as completed Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants